Interface Message
public interface Message
AMQP 1.0 message.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionlong
Get the expiry time.absoluteExpiryTime
(long absoluteExpiryTime) Set the expiry time.annotation
(String key) Get the value of a message annotation.annotation
(String key, Object value) Set the value of a message annotation.byte[]
body()
Get the message body.body
(byte[] body) Set the body of the message.Get the content-encoding.contentEncoding
(String contentEncoding) Set the content-encoding.Get the content-type.contentType
(String contentType) Set the content-type.Get message correlation ID.correlationId
(byte[] correlationId) Set the message correlation ID (array of bytes).correlationId
(long correlationId) Set the message correlation ID (long).correlationId
(Object correlationId) Set the message correlation ID.correlationId
(String correlationId) Set the message correlation ID (string).correlationId
(UUID correlationId) Set the message correlation ID (UUID).byte[]
Get message correlation ID as an array of bytes.long
Get message correlation ID as a long.Get message correlation ID as a string.Get message correlation ID as a UUID.long
Get the creation time.creationTime
(long creationTime) Set the creation time.boolean
durable()
Whether the message is durable.durable
(boolean durable) Mark the message as durable or not.boolean
Whether the message may have been acquired by another link.forEachAnnotation
(BiConsumer<String, Object> action) Iterate over message annotations.forEachProperty
(BiConsumer<String, Object> action) Iterate over application properties.groupId()
Get the group ID.Set the group ID.int
Get the message position in its group.groupSequence
(int groupSequence) Set the position of the message in its group.boolean
hasAnnotation
(String key) Whether a message annotation is set.boolean
Whether the message has message annotation.boolean
Whether at least one application property is set on the message.boolean
hasProperty
(String key) Check an application property is set.Get message ID.messageId
(byte[] id) Set the message ID (array of bytes).messageId
(long id) Set the message ID (long).Set the message ID.Set the message ID (string).Set the message ID (UUID).byte[]
Get message ID as an array of bytes.long
Get message ID as a long.Get message ID as a string.Get message ID as a UUID.byte
priority()
Get the message priority.priority
(byte priority) Set the priority of the message.Get the value of an application property.Set an application property.Set an application property.Set an application property.Set an application property.Set an application property.Set an application property.Set an application property.Set an application property.Set an application property.Set an application property.Set an application property.propertyDecimal128
(String key, BigDecimal value) Set an application property.propertyDecimal32
(String key, BigDecimal value) Set an application property.propertyDecimal64
(String key, BigDecimal value) Set an application property.propertySymbol
(String key, String value) Set an application property.propertyTimestamp
(String key, long value) Set an application property.propertyUnsigned
(String key, byte value) Set an application property.propertyUnsigned
(String key, int value) Set an application property.propertyUnsigned
(String key, long value) Set an application property.propertyUnsigned
(String key, short value) Set an application property.removeAnnotation
(String key) Remove an annotation.removeProperty
(String key) Remove an application property.replyTo()
Get the reply-to field.Set the reply-to field.AddressBuilder
for thereplyTo()
field.Get the reply-to group ID.replyToGroupId
(String groupId) Set the reply-to group ID.subject()
Get the subject.Set the message subject.to()
Get the to field.Set the to field.AddressBuilder
for theto()
field.ttl()
Get the message TTL.Set the message TTL.byte[]
userId()
Get user IDuserId
(byte[] userId) Set the user ID.
-
Method Details
-
messageId
-
messageIdAsString
-
messageIdAsLong
long messageIdAsLong()Get message ID as a long.- Returns:
- the message ID as a long
-
messageIdAsBinary
byte[] messageIdAsBinary()Get message ID as an array of bytes.- Returns:
- the message ID as an array of bytes
-
messageIdAsUuid
-
correlationId
-
correlationIdAsString
String correlationIdAsString()Get message correlation ID as a string.- Returns:
- the message correlation ID as a string
-
correlationIdAsLong
long correlationIdAsLong()Get message correlation ID as a long.- Returns:
- the message correlation ID as a long
-
correlationIdAsBinary
byte[] correlationIdAsBinary()Get message correlation ID as an array of bytes.- Returns:
- the message correlation ID as an array of bytes
-
correlationIdAsUuid
UUID correlationIdAsUuid()Get message correlation ID as a UUID.- Returns:
- the message correlation ID as a UUID
-
userId
byte[] userId()Get user ID- Returns:
- the user ID
-
to
-
subject
-
replyTo
-
messageId
-
messageId
-
messageId
Set the message ID (long).- Parameters:
id
- message ID- Returns:
- the message
-
messageId
Set the message ID (array of bytes).- Parameters:
id
- message ID- Returns:
- the message
-
messageId
-
correlationId
-
correlationId
-
correlationId
Set the message correlation ID (long).- Parameters:
correlationId
- correlation ID- Returns:
- the message
-
correlationId
Set the message correlation ID (array of bytes).- Parameters:
correlationId
- correlation ID- Returns:
- the message
-
correlationId
-
userId
-
to
Set the to field.Prefer using
toAddress()
to build the target address.- Parameters:
address
- to address- Returns:
- the message
- See Also:
-
subject
-
replyTo
Set the reply-to field.Prefer using
replyToAddress()
to build the reply-to address.- Parameters:
replyTo
- reply-to field- Returns:
- the message
- See Also:
-
contentType
-
contentEncoding
-
absoluteExpiryTime
Set the expiry time.- Parameters:
absoluteExpiryTime
- expiry time- Returns:
- the message
-
creationTime
Set the creation time.- Parameters:
creationTime
- creation time- Returns:
- the message
-
groupId
-
groupSequence
Set the position of the message in its group.- Parameters:
groupSequence
- group sequence- Returns:
- the message
-
replyToGroupId
-
contentType
-
contentEncoding
-
absoluteExpiryTime
long absoluteExpiryTime()Get the expiry time.- Returns:
- the expiry time
-
creationTime
long creationTime()Get the creation time.- Returns:
- the creation time
-
groupId
-
groupSequence
int groupSequence()Get the message position in its group.- Returns:
- the group sequence
-
replyToGroupId
-
property
-
property
-
property
-
property
-
property
-
property
-
propertyUnsigned
-
propertyUnsigned
-
propertyUnsigned
-
propertyUnsigned
-
property
-
property
-
propertyDecimal32
Set an application property.- Parameters:
key
- property keyvalue
- property value- Returns:
- the message
-
propertyDecimal64
Set an application property.- Parameters:
key
- property keyvalue
- property value- Returns:
- the message
-
propertyDecimal128
Set an application property.- Parameters:
key
- property keyvalue
- property value- Returns:
- the message
-
property
-
propertyTimestamp
-
property
-
property
-
property
-
propertySymbol
-
hasProperty
Check an application property is set.- Parameters:
key
- property name- Returns:
- true if set, false otherwise
-
hasProperties
boolean hasProperties()Whether at least one application property is set on the message.- Returns:
- true if the message has at least one application property, false otherwise
-
removeProperty
-
forEachProperty
Iterate over application properties.- Parameters:
action
- action to execute for each application property- Returns:
- the message
-
body
Set the body of the message.- Parameters:
body
- message body- Returns:
- the message
-
body
byte[] body()Get the message body.- Returns:
- the message body
-
durable
Mark the message as durable or not.Messages are durable by default, use
false
to make them explicitly non-durable.Durability depends also on the queue messages end up in (e.g. quorum queues and streams always store messages durably).
- Parameters:
durable
- true for a durable message, false for a non-durable message- Returns:
- the message
-
durable
boolean durable()Whether the message is durable.- Returns:
- true if durable, false otherwise
- See Also:
-
priority
Set the priority of the message.- Parameters:
priority
- message priority- Returns:
- the message
- See Also:
-
priority
byte priority()Get the message priority.- Returns:
- the message priority
- See Also:
-
ttl
-
ttl
-
firstAcquirer
boolean firstAcquirer()Whether the message may have been acquired by another link.- Returns:
- true if the message has not been acquired by another link, false if it may have been already acquired by another link
- See Also:
-
annotation
-
annotation
-
hasAnnotation
Whether a message annotation is set.- Parameters:
key
- annotation key- Returns:
- true if the annotation is set, false otherwise
- See Also:
-
hasAnnotations
boolean hasAnnotations()Whether the message has message annotation.- Returns:
- true if the message has annotations, false otherwise
- See Also:
-
removeAnnotation
-
forEachAnnotation
Iterate over message annotations.- Parameters:
action
- action to execute for each message annotation- Returns:
- the message
-
toAddress
Message.MessageAddressBuilder toAddress()AddressBuilder
for theto()
field.- Returns:
- the address builder
-
replyToAddress
Message.MessageAddressBuilder replyToAddress()AddressBuilder
for thereplyTo()
field.- Returns:
- the address builder
-