Interface Message
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 Message
Add a message annotation to the message.default Message
copy()
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.long
Get the publishing ID for the message.boolean
Does 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
Get the application properties of the message.- Returns:
- the application properties of the message
-
getMessageAnnotations
Get the message annotations of the message.Message annotations are aimed at the infrastructure, use application properties for application-specific key/value pairs.
- Returns:
- the message annotations
-
annotate
Add a message annotation to the message.- Parameters:
key
- the message annotation keyvalue
- the message annotation value- Returns:
- the modified message
- Since:
- 0.12.0
-
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
-