Class Message
java.lang.Object
com.codename1.backend.messaging.Message
One message: a destination, an optional key, headers, and the payload as
bytes. What a listener is handed when it asks for more than the payload, and
what MessageTemplate.send(Message) sends as it is.
The key is what a partitioned transport (Kafka) orders by; the others carry it
as a header. Header names starting with cn1- are the runtime's own: the
delivery attempt, the error a dead-lettered message failed with, and the
destination it came from.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe delivery attempt, counted from 1.static final StringThe content type of the payload:application/json,text/plainorapplication/octet-stream.static final StringThe text of the failure that dead-lettered a message.static final StringThe time, in epoch milliseconds, before which a retried message is not handled again.static final StringThe destination a dead-lettered message was sent to first. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintWhich delivery of this message this is, counted from 1.Where it is sent: a queue, a topic or a stream, whichever the transport has.One header, or null.The headers, which a listener may read but not change.getId()The transport's identifier of this delivery, or null before it is sent.getKey()The ordering key, or null.byte[]The payload.getText()The payload as UTF-8 text.A copy sent totoinstead.toString()Returns a string representation of the object.withHeader(String name, String value) A copy withnameset tovalue, or removed whenvalueis null.
-
Field Details
-
ATTEMPT
-
ERROR
-
ORIGIN
The destination a dead-lettered message was sent to first.- See Also:
-
NOT_BEFORE
The time, in epoch milliseconds, before which a retried message is not handled again.- See Also:
-
CONTENT_TYPE
The content type of the payload:application/json,text/plainorapplication/octet-stream.- See Also:
-
-
Constructor Details
-
Message
A message todestinationwith no key. -
Message
-
-
Method Details
-
getDestination
Where it is sent: a queue, a topic or a stream, whichever the transport has. -
getKey
The ordering key, or null. -
getPayload
public byte[] getPayload()The payload. Not copied; do not change it. -
getText
The payload as UTF-8 text. -
getHeaders
-
getHeader
-
getAttempt
public int getAttempt()Which delivery of this message this is, counted from 1. -
getId
The transport's identifier of this delivery, or null before it is sent. -
withHeader
-
to
-
toString
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-