Class OrderedMessage
- java.lang.Object
-
- dk.cloudcreate.essentials.shared.functional.tuple.Pair<Object,MessageMetaData>
-
- dk.cloudcreate.essentials.components.foundation.messaging.queue.Message
-
- dk.cloudcreate.essentials.components.foundation.messaging.queue.OrderedMessage
-
- All Implemented Interfaces:
dk.cloudcreate.essentials.shared.functional.tuple.Tuple<dk.cloudcreate.essentials.shared.functional.tuple.Pair<Object,MessageMetaData>>,Serializable
public class OrderedMessage extends Message
Represents a message that will be delivered in order.
This of course requires that message are queued in order and that the consumer is single threaded.
All messages sharing the samekey, will be delivered according to theirorder
An example of a message key is the id of the entity the message relates to- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OrderedMessage(Object payload, String key, long order)OrderedMessage(Object payload, String key, long order, MessageMetaData metaData)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetKey()All messages sharing the same key, will be delivered according to theirgetOrder()
An example of a message key is the id of the entity the message relates tolonggetOrder()Represent the order of a message relative to thegetKey().
All messages sharing the same key, will be delivered according to theirgetOrder()static OrderedMessageof(Object payload, String key, long order)Create a newMessageand an emptyMessageMetaDatastatic OrderedMessageof(Object payload, String key, long order, MessageMetaData metaData)Create a newMessageStringtoString()-
Methods inherited from class dk.cloudcreate.essentials.components.foundation.messaging.queue.Message
getMetaData, getPayload, of, of
-
-
-
-
Constructor Detail
-
OrderedMessage
public OrderedMessage(Object payload, String key, long order)
- Parameters:
payload- the message payloadkey- the message key. All messages sharing the same key, will be delivered according to theirgetOrder()order- the order of the message relative to thegetKey().
-
OrderedMessage
public OrderedMessage(Object payload, String key, long order, MessageMetaData metaData)
- Parameters:
payload- the message payloadkey- the message key. All messages sharing the same key, will be delivered according to theirgetOrder()order- the order of the message relative to thegetKey().metaData- theMessageMetaDataassociated with the message
-
-
Method Detail
-
of
public static OrderedMessage of(Object payload, String key, long order)
Create a newMessageand an emptyMessageMetaData- Parameters:
payload- the message payloadkey- the message key. All messages sharing the same key, will be delivered according to theirgetOrder()order- the order of the message relative to thegetKey().- Returns:
- the new
Message
-
of
public static OrderedMessage of(Object payload, String key, long order, MessageMetaData metaData)
Create a newMessage- Parameters:
payload- the message payloadkey- the message key. All messages sharing the same key, will be delivered according to theirgetOrder()order- the order of the message relative to thegetKey().metaData- theMessageMetaDataassociated with the message- Returns:
- the new
Message
-
getKey
public String getKey()
All messages sharing the same key, will be delivered according to theirgetOrder()
An example of a message key is the id of the entity the message relates to- Returns:
- The message key
-
getOrder
public long getOrder()
Represent the order of a message relative to thegetKey().
All messages sharing the same key, will be delivered according to theirgetOrder()- Returns:
- the order of a message relative to the
getKey()
-
-