public class Message
extends java.lang.Object
Constructor | Description |
---|---|
Message(java.lang.Object payload) |
Initializes an instance of Message.
|
Message(java.lang.Object payload,
TimeSpan timeSpan) |
Initializes an instance of Message.
|
Modifier and Type | Method | Description |
---|---|---|
java.util.Date |
getCreationTime() |
Creation time in DateTime for the message.
|
TimeSpan |
getExpirationTime() |
ExpirationTime of TimeSpan type after which the message is expired from the topic.
|
java.lang.String |
getMessageId() |
Auto generated ID for the message, as same messages can be stored on different topics.
|
java.lang.Object |
getPayload() |
The actual data object of interest for subscribers, for example, Order.
|
<T> T |
getPayloadAsJson(java.lang.Class<?> cls) |
This method is used to get underlying payload that is stored in json form.
|
void |
setCreationTime(java.util.Date value) |
Creation time in DateTime for the message.
|
void |
setExpirationTime(TimeSpan value) |
Sets the expiration time of the message.
|
void |
setMessageId(java.lang.String value) |
Sets the message id of the message.
|
void |
setSerializationDataInternal(PayloadDeserializer serializer,
java.lang.Object serializePayload) |
This method is only created for internal use, it is not recommended to use it
|
public Message(java.lang.Object payload)
payload
- Payload of message.public Message(java.lang.Object payload, TimeSpan timeSpan)
payload
- Payload of message.timeSpan
- Expiry time of message.public final java.lang.String getMessageId()
public final void setMessageId(java.lang.String value)
value
- The id to be set to message.public final TimeSpan getExpirationTime()
public final void setExpirationTime(TimeSpan value)
value
- The value that is to be set as expiration time.public final java.lang.Object getPayload()
public final void setSerializationDataInternal(PayloadDeserializer serializer, java.lang.Object serializePayload)
serializer
- serializePayload
- public final <T> T getPayloadAsJson(java.lang.Class<?> cls) throws OperationFailedException, com.fasterxml.jackson.core.JsonProcessingException
T
- Specifies the type of payload.cls
- Specifies the class of payload.OperationFailedException
com.fasterxml.jackson.core.JsonProcessingException
public final java.util.Date getCreationTime()
public final void setCreationTime(java.util.Date value)
value
- The creation time of the message.