MotechEvent¶
-
public class
MotechEvent
implements Serializable¶ Motech Scheduled Event data carrier class. It contains a subject, to which listeners can subscribe and a payload in the form of a map of parameters. Instance of this class with event specific data will be sent by Motech Scheduler when a scheduled event is fired.
This class is immutable
Constructors¶
MotechEvent¶
MotechEvent¶
-
public
MotechEvent
(String subject, Map<String, Object> parameters)¶ Constructs a MotechEvent with the given subject and parameters.
Parameters: - subject – the subject of the event
- parameters – the map of additional parameters
Throws: - IllegalArgumentException – if the subject is null or contains
'*', '..'
MotechEvent¶
-
public
MotechEvent
(String subject, Map<String, Object> parameters, String callbackName)¶ Constructs a MotechEvent with the given subject, parameters and the callback name.
Parameters: - subject – the subject of the event
- parameters – the map of additional parameters
- callbackName – the name of the callback
Throws: - IllegalArgumentException – if the subject is null or contains
'*', '..'
MotechEvent¶
-
public
MotechEvent
(String subject, Map<String, Object> parameters, String callbackName, Map<String, Object> metadata)¶ Constructs a MotechEvent with the given subject, parameters and the callback name.
Parameters: - subject – the subject of the event
- parameters – the map of additional parameters
- callbackName – the name of the callback
- metadata – the map of event metadata
Throws: - IllegalArgumentException – if the subject is null or contains
'*', '..'
Methods¶
getCallbackName¶
getMessageDestination¶
getMessageRedeliveryCount¶
-
public int
getMessageRedeliveryCount
()¶ Returns the
redeliveryCount
. This is incremented by the event system if the delivery fails, so it is equal to the number of failed deliveries. Any exception from the handler is counted as failure in this context. It cannot be larger thanorg.motechproject.event.messaging.MotechEventConfig.messageMaxRedeliveryCount
Returns: the number of message redeliveries
getMetadata¶
getParameters¶
incrementMessageRedeliveryCount¶
-
public void
incrementMessageRedeliveryCount
()¶ Increments the
redeliveryCount
. It is invoked by the event system if the delivery fails. If it is null, sets the value to 0.
isBroadcast¶
-
public boolean
isBroadcast
()¶ Returns whether event is a broadcast event
Returns: broadcast
isDiscarded¶
-
public boolean
isDiscarded
()¶ Returns whether event is discarded
Returns: event discarded
setBroadcast¶
-
public void
setBroadcast
(boolean value)¶ Sets event as a broadcast event
Parameters: - value –