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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Message
annotate(String key, Object value)
Add a message annotation to the message.default Message
copy()
Create a copy of the message.Map<String,Object>
getApplicationProperties()
Get the application properties of the message.Object
getBody()
Get the message body.byte[]
getBodyAsBinary()
Get the body of the message as an array of bytes.Map<String,Object>
getMessageAnnotations()
Get the message annotations of the message.Properties
getProperties()
Get the properties of the message.long
getPublishingId()
Get the publishing ID for the message.boolean
hasPublishingId()
Does this message has a publishing ID?
-
-
-
Method Detail
-
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:
ProducerBuilder.name(String)
, Deduplication documentation
-
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:
ProducerBuilder.name(String)
, Deduplication documentation
-
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
Map<String,Object> getApplicationProperties()
Get the application properties of the message.- Returns:
- the application properties of the message
-
getMessageAnnotations
Map<String,Object> 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
default Message annotate(String key, Object value)
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
default Message 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
-
-