Interface Message
public interface Message
API for outbound and inbound messages.
A RabbitMQ stream message must comply to the AMQP 1.0 message format for the best interoperability.
Please see section 3.2 "message format" of the AMQP 1.0 specification to find out about the exact meaning of the message sections.
Messages instances are usually created with a MessageBuilder.
-
Method Summary
Modifier and TypeMethodDescriptiondefault MessageAdd a message annotation to the message.default Messagecopy()Create a copy of the message.Get the application properties of the message.getBody()Get the message body.byte[]Get the body of the message as an array of bytes.Get the message annotations of the message.Get the properties of the message.longGet the publishing ID for the message.booleanDoes this message has a publishing ID?
-
Method Details
-
hasPublishingId
boolean hasPublishingId()Does this message has a publishing ID?Publishing IDs are used for deduplication of outbound messages. They are not persisted.
- Returns:
- true if the message has a publishing ID, false otherwise
- See Also:
-
getPublishingId
long getPublishingId()Get the publishing ID for the message.Publishing IDs are used for deduplication of outbound messages. They are not persisted.
- Returns:
- the publishing ID of the message
- See Also:
-
getBodyAsBinary
byte[] getBodyAsBinary()Get the body of the message as an array of bytes.- Returns:
- the message body
-
getBody
Object getBody()Get the message body.The actual type is defined by the underlying AMQP 1.0 codec.
- Returns:
- the message body
-
getProperties
Properties getProperties()Get the properties of the message.- Returns:
- the properties of the message
-
getApplicationProperties
-
getMessageAnnotations
-
annotate
-
copy
Create a copy of the message.The message copy contains the exact same instances of the original bare message (body, properties, application properties), only the message annotations are actually copied and can be modified independently.
- Returns:
- the message copy
- Since:
- 0.12.0
-