Interface Message
-
- All Known Subinterfaces:
ClientMessage
,ICoreMessage
public interface Message
A Message is a routable instance that has a payload.The payload (the "body") is opaque to the messaging system. A Message also has a fixed set of headers (required by the messaging system) and properties (defined by the users) that can be used by the messaging system to route the message (e.g. to ensure it matches a queue filter).
Message Properties
Message can contain properties specified by the users. It is possible to convert from some types to other types as specified by the following table:
| | boolean byte short int long float double String byte[] |---------------------------------------------------------------- |boolean | X X |byte | X X X X X |short | X X X X |int | X X X |long | X X |float | X X X |double | X X |String | X X X X X X X X |byte[] | X |-----------------------------------------------------------------
If conversion is not allowed (for example calling
getFloatProperty
on a property set aboolean
), aActiveMQPropertyConversionException
will be thrown. User cases that will be covered by Message Receiving a buffer: Message encode = new CoreMessage(); // or any other implementation encode.receiveBuffer(buffer); Sending to a buffer: Message encode; size = encode.getEncodeSize(); encode.encodeDirectly(bufferOutput);
-
-
Field Summary
Fields Modifier and Type Field Description static byte
BYTES_TYPE
static byte
DEFAULT_TYPE
static byte
EMBEDDED_TYPE
The message will contain another message persisted through org.apache.activemq.artemis.spi.core.protocol.EmbedMessageUtilstatic org.apache.activemq.artemis.api.core.SimpleString
HDR_ACTUAL_EXPIRY_TIME
the actual time the message was expired.static org.apache.activemq.artemis.api.core.SimpleString
HDR_BRIDGE_DUPLICATE_ID
static org.apache.activemq.artemis.api.core.SimpleString
HDR_CONTENT_TYPE
To define the mime-type of body messages.static org.apache.activemq.artemis.api.core.SimpleString
HDR_DUPLICATE_DETECTION_ID
To be used with duplicate detection.static org.apache.activemq.artemis.api.core.SimpleString
HDR_GROUP_ID
For the Message Grouping feature.static org.apache.activemq.artemis.api.core.SimpleString
HDR_GROUP_SEQUENCE
static org.apache.activemq.artemis.api.core.SimpleString
HDR_INGRESS_TIMESTAMP
The time at which the message arrived at the broker.static org.apache.activemq.artemis.api.core.SimpleString
HDR_LARGE_BODY_SIZE
The body size of a large message before it was compressed.static org.apache.activemq.artemis.api.core.SimpleString
HDR_LARGE_COMPRESSED
to determine if the Large Message was compressed.static org.apache.activemq.artemis.api.core.SimpleString
HDR_LAST_VALUE_NAME
To be used with Last value queues.static org.apache.activemq.artemis.api.core.SimpleString
HDR_ORIG_MESSAGE_ID
The original message ID before the message was transferred.static org.apache.activemq.artemis.api.core.SimpleString
HDR_ORIG_ROUTING_TYPE
The original routing type of a message before getting transferred through DLQ or expirystatic org.apache.activemq.artemis.api.core.SimpleString
HDR_ORIGINAL_ADDRESS
The original address of a message when a message is diverted or transferred through DLQ or expirystatic org.apache.activemq.artemis.api.core.SimpleString
HDR_ORIGINAL_QUEUE
The original address of a message when a message is transferred through DLQ or expirystatic org.apache.activemq.artemis.api.core.SimpleString
HDR_PREFIX
The prefix used (if any) when sending this message.static org.apache.activemq.artemis.api.core.SimpleString
HDR_ROUTE_TO_ACK_IDS
static org.apache.activemq.artemis.api.core.SimpleString
HDR_ROUTE_TO_IDS
static org.apache.activemq.artemis.api.core.SimpleString
HDR_ROUTING_TYPE
The Routing Type for this message.static org.apache.activemq.artemis.api.core.SimpleString
HDR_SCALEDOWN_TO_IDS
static org.apache.activemq.artemis.api.core.SimpleString
HDR_SCHEDULED_DELIVERY_TIME
To be used with Scheduled Delivery.static org.apache.activemq.artemis.api.core.SimpleString
HDR_VALIDATED_USER
The name of the validated user who sent the message.static java.util.function.Predicate<org.apache.activemq.artemis.api.core.SimpleString>
INTERNAL_PROPERTY_NAMES_PREDICATE
static byte
LARGE_EMBEDDED_TYPE
This is to embedd Large Messages from other protocolstatic byte
MAP_TYPE
static int
memoryOffset
static byte
OBJECT_TYPE
static byte
STREAM_TYPE
static byte
TEXT_TYPE
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default boolean
acceptsConsumer(long uniqueConsumerID)
default void
clearInternalProperties()
boolean
containsProperty(java.lang.String key)
boolean
containsProperty(org.apache.activemq.artemis.api.core.SimpleString key)
Message
copy()
It will generate a new instance of the message encode, being a deep copy, new properties, new everythingMessage
copy(long newID)
It will generate a new instance of the message encode, being a deep copy, new properties, new everythingdefault Message
copy(long newID, boolean isExpiryOrDLQ)
It will generate a new instance of the message encode, being a deep copy, new properties, new everythingint
durableDown()
int
durableUp()
java.lang.String
getAddress()
org.apache.activemq.artemis.api.core.SimpleString
getAddressSimpleString()
java.lang.Object
getAnnotation(org.apache.activemq.artemis.api.core.SimpleString key)
default java.lang.String
getAnnotationString(org.apache.activemq.artemis.api.core.SimpleString key)
default org.apache.activemq.artemis.api.core.ActiveMQBuffer
getBodyBuffer()
Deprecated.do not use this, use through ICoreMessage or ClientMessage Warning: if you need to read the content of a message use getDataBuffer().default java.io.InputStream
getBodyInputStream()
Deprecated.do not use this, use through ICoreMessage or ClientMessagejava.lang.Boolean
getBooleanProperty(java.lang.String key)
java.lang.Boolean
getBooleanProperty(org.apache.activemq.artemis.api.core.SimpleString key)
default java.lang.Object
getBrokerProperty(org.apache.activemq.artemis.api.core.SimpleString key)
java.lang.Byte
getByteProperty(java.lang.String key)
java.lang.Byte
getByteProperty(org.apache.activemq.artemis.api.core.SimpleString key)
byte[]
getBytesProperty(java.lang.String key)
byte[]
getBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key)
default java.lang.String
getConnectionID()
default java.lang.Object
getCorrelationID()
java.lang.Double
getDoubleProperty(java.lang.String key)
java.lang.Double
getDoubleProperty(org.apache.activemq.artemis.api.core.SimpleString key)
default byte[]
getDuplicateIDBytes()
it will translate a property named HDR_DUPLICATE_DETECTION_ID.default java.lang.Object
getDuplicateProperty()
int
getDurableCount()
int
getEncodeSize()
Returns the size of the encoded message.long
getExpiration()
Returns the expiration time of this message.default byte[]
getExtraBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key)
java.lang.Float
getFloatProperty(java.lang.String key)
java.lang.Float
getFloatProperty(org.apache.activemq.artemis.api.core.SimpleString key)
default org.apache.activemq.artemis.api.core.SimpleString
getGroupID()
default int
getGroupSequence()
default java.lang.Long
getIngressTimestamp()
java.lang.Integer
getIntProperty(java.lang.String key)
java.lang.Integer
getIntProperty(org.apache.activemq.artemis.api.core.SimpleString key)
default org.apache.activemq.artemis.api.core.SimpleString
getLastValueProperty()
java.lang.Long
getLongProperty(java.lang.String key)
java.lang.Long
getLongProperty(org.apache.activemq.artemis.api.core.SimpleString key)
int
getMemoryEstimate()
long
getMessageID()
Returns the messageID.java.lang.Object
getObjectProperty(java.lang.String key)
java.lang.Object
getObjectProperty(org.apache.activemq.artemis.api.core.SimpleString key)
default java.lang.Object
getObjectPropertyForFilter(org.apache.activemq.artemis.api.core.SimpleString key)
java.lang.Object
getOwner()
long
getPersistentSize()
This is the size of the message when persisted on disk which is used for metrics tracking Note that even if the message itself is not persisted on disk (ie non-durable) this value is still used for metrics tracking If a normal message it will be the encoded message size If a large message it will be encoded message size + large message body sizeorg.apache.activemq.artemis.core.persistence.Persister<Message>
getPersister()
int
getPersistSize()
byte
getPriority()
Returns the message priority.java.util.Set<org.apache.activemq.artemis.api.core.SimpleString>
getPropertyNames()
Returns all the names of the properties for this message.java.lang.String
getProtocolName()
int
getRefCount()
org.apache.activemq.artemis.api.core.SimpleString
getReplyTo()
default org.apache.activemq.artemis.api.core.RoutingType
getRoutingType()
java.lang.Long
getScheduledDeliveryTime()
Used to calculate what is the delivery time.java.lang.Short
getShortProperty(java.lang.String key)
java.lang.Short
getShortProperty(org.apache.activemq.artemis.api.core.SimpleString key)
org.apache.activemq.artemis.api.core.SimpleString
getSimpleStringProperty(java.lang.String key)
org.apache.activemq.artemis.api.core.SimpleString
getSimpleStringProperty(org.apache.activemq.artemis.api.core.SimpleString key)
default java.lang.String
getStringBody()
java.lang.String
getStringProperty(java.lang.String key)
java.lang.String
getStringProperty(org.apache.activemq.artemis.api.core.SimpleString key)
long
getTimestamp()
default byte
getType()
Deprecated.do not use this, use through ICoreMessage or ClientMessageint
getUsage()
java.lang.Object
getUserContext(java.lang.Object key)
Used for user context data.java.lang.Object
getUserID()
This represents historically the JMSMessageID.default java.lang.String
getValidatedUserID()
default long
getWholeMessageSize()
Return an estimate of the size of the message on the wire.default boolean
hasScheduledDeliveryTime()
Search for the existence of the property: an implementor can save the message to be decoded, if possible.boolean
isDurable()
Returns whether this message is durable or not.default boolean
isExpired()
Returns whether this message is expired or not.default boolean
isLargeMessage()
void
messageChanged()
WARNING: Calling this method on a AMQPMessage will allow the non mutable part of the message to be modified.void
persist(org.apache.activemq.artemis.api.core.ActiveMQBuffer targetRecord)
Message
putBooleanProperty(java.lang.String key, boolean value)
Message
putBooleanProperty(org.apache.activemq.artemis.api.core.SimpleString key, boolean value)
Message
putByteProperty(java.lang.String key, byte value)
Message
putByteProperty(org.apache.activemq.artemis.api.core.SimpleString key, byte value)
Message
putBytesProperty(java.lang.String key, byte[] value)
Message
putBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key, byte[] value)
Message
putCharProperty(java.lang.String key, char value)
Message
putCharProperty(org.apache.activemq.artemis.api.core.SimpleString key, char value)
Message
putDoubleProperty(java.lang.String key, double value)
Message
putDoubleProperty(org.apache.activemq.artemis.api.core.SimpleString key, double value)
default Message
putExtraBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key, byte[] value)
Message
putFloatProperty(java.lang.String key, float value)
Message
putFloatProperty(org.apache.activemq.artemis.api.core.SimpleString key, float value)
Message
putIntProperty(java.lang.String key, int value)
Message
putIntProperty(org.apache.activemq.artemis.api.core.SimpleString key, int value)
Message
putLongProperty(java.lang.String key, long value)
Message
putLongProperty(org.apache.activemq.artemis.api.core.SimpleString key, long value)
Message
putObjectProperty(java.lang.String key, java.lang.Object value)
Message
putObjectProperty(org.apache.activemq.artemis.api.core.SimpleString key, java.lang.Object value)
Message
putShortProperty(java.lang.String key, short value)
Message
putShortProperty(org.apache.activemq.artemis.api.core.SimpleString key, short value)
Message
putStringProperty(java.lang.String key, java.lang.String value)
Puts a String property in this message.Message
putStringProperty(org.apache.activemq.artemis.api.core.SimpleString key, java.lang.String value)
Message
putStringProperty(org.apache.activemq.artemis.api.core.SimpleString key, org.apache.activemq.artemis.api.core.SimpleString value)
void
receiveBuffer(io.netty.buffer.ByteBuf buffer)
Used to receive this message from an encoded medium bufferdefault void
reencode()
int
refDown()
default void
referenceOriginalMessage(Message original, org.apache.activemq.artemis.api.core.SimpleString originalQueue)
int
refUp()
default void
rejectConsumer(long uniqueConsumerID)
void
reloadPersistence(org.apache.activemq.artemis.api.core.ActiveMQBuffer record, org.apache.activemq.artemis.core.persistence.CoreMessageObjectPools pools)
default java.lang.Object
removeAnnotation(org.apache.activemq.artemis.api.core.SimpleString key)
default byte[]
removeExtraBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key)
java.lang.Object
removeProperty(java.lang.String key)
java.lang.Object
removeProperty(org.apache.activemq.artemis.api.core.SimpleString key)
void
sendBuffer(io.netty.buffer.ByteBuf buffer, int deliveryCount)
Used to send this message to an encoded medium buffer.Message
setAddress(java.lang.String address)
Look atsetAddress(SimpleString)
for the doc.Message
setAddress(org.apache.activemq.artemis.api.core.SimpleString address)
This will set the address on CoreMessage.default Message
setAnnotation(org.apache.activemq.artemis.api.core.SimpleString key, java.lang.Object value)
Callers must callreencode()
in order to be sent to clientsdefault Message
setBrokerProperty(org.apache.activemq.artemis.api.core.SimpleString key, java.lang.Object value)
To be called by the broker on ocasions such as DLQ and expiry.default Message
setConnectionID(java.lang.String connectionID)
default Message
setCorrelationID(java.lang.Object correlationID)
Message
setDurable(boolean durable)
Sets whether this message is durable or not.Message
setExpiration(long expiration)
Sets the expiration of this message.default Message
setGroupID(java.lang.String groupID)
default Message
setGroupID(org.apache.activemq.artemis.api.core.SimpleString groupID)
default Message
setGroupSequence(int sequence)
default Message
setIngressTimestamp()
default Message
setLastValueProperty(org.apache.activemq.artemis.api.core.SimpleString lastValueName)
Message
setMessageID(long id)
void
setOwner(java.lang.Object object)
Message
setPriority(byte priority)
Sets the message priority.Message
setReplyTo(org.apache.activemq.artemis.api.core.SimpleString address)
default Message
setRoutingType(org.apache.activemq.artemis.api.core.RoutingType routingType)
default Message
setScheduledDeliveryTime(java.lang.Long time)
Message
setTimestamp(long timestamp)
default Message
setType(byte type)
Deprecated.do not use this, use through ICoreMessage or ClientMessagevoid
setUserContext(java.lang.Object key, java.lang.Object value)
Used for user context data.Message
setUserID(java.lang.Object userID)
default Message
setValidatedUserID(java.lang.String validatedUserID)
default javax.management.openmbean.CompositeData
toCompositeData(int fieldsLimit, int deliveryCount)
ICoreMessage
toCore()
This should make you convert your message into Core format.ICoreMessage
toCore(org.apache.activemq.artemis.core.persistence.CoreMessageObjectPools coreMessageObjectPools)
This should make you convert your message into Core format.default java.util.Map<java.lang.String,java.lang.Object>
toMap()
default java.util.Map<java.lang.String,java.lang.Object>
toMap(int valueSizeLimit)
default java.util.Map<java.lang.String,java.lang.Object>
toPropertyMap()
default java.util.Map<java.lang.String,java.lang.Object>
toPropertyMap(int valueSizeLimit)
int
usageDown()
int
usageUp()
this method indicates usage by components such as large message or page cache.
-
-
-
Field Detail
-
memoryOffset
static final int memoryOffset
- See Also:
- Constant Field Values
-
INTERNAL_PROPERTY_NAMES_PREDICATE
static final java.util.function.Predicate<org.apache.activemq.artemis.api.core.SimpleString> INTERNAL_PROPERTY_NAMES_PREDICATE
-
HDR_ROUTE_TO_IDS
static final org.apache.activemq.artemis.api.core.SimpleString HDR_ROUTE_TO_IDS
-
HDR_SCALEDOWN_TO_IDS
static final org.apache.activemq.artemis.api.core.SimpleString HDR_SCALEDOWN_TO_IDS
-
HDR_ROUTE_TO_ACK_IDS
static final org.apache.activemq.artemis.api.core.SimpleString HDR_ROUTE_TO_ACK_IDS
-
HDR_BRIDGE_DUPLICATE_ID
static final org.apache.activemq.artemis.api.core.SimpleString HDR_BRIDGE_DUPLICATE_ID
-
HDR_ACTUAL_EXPIRY_TIME
static final org.apache.activemq.artemis.api.core.SimpleString HDR_ACTUAL_EXPIRY_TIME
the actual time the message was expired. * *
-
HDR_ORIGINAL_ADDRESS
static final org.apache.activemq.artemis.api.core.SimpleString HDR_ORIGINAL_ADDRESS
The original address of a message when a message is diverted or transferred through DLQ or expiry
-
HDR_ORIGINAL_QUEUE
static final org.apache.activemq.artemis.api.core.SimpleString HDR_ORIGINAL_QUEUE
The original address of a message when a message is transferred through DLQ or expiry
-
HDR_ORIG_MESSAGE_ID
static final org.apache.activemq.artemis.api.core.SimpleString HDR_ORIG_MESSAGE_ID
The original message ID before the message was transferred.
-
HDR_GROUP_ID
static final org.apache.activemq.artemis.api.core.SimpleString HDR_GROUP_ID
For the Message Grouping feature.
-
HDR_GROUP_SEQUENCE
static final org.apache.activemq.artemis.api.core.SimpleString HDR_GROUP_SEQUENCE
-
HDR_LARGE_COMPRESSED
static final org.apache.activemq.artemis.api.core.SimpleString HDR_LARGE_COMPRESSED
to determine if the Large Message was compressed.
-
HDR_LARGE_BODY_SIZE
static final org.apache.activemq.artemis.api.core.SimpleString HDR_LARGE_BODY_SIZE
The body size of a large message before it was compressed.
-
HDR_SCHEDULED_DELIVERY_TIME
static final org.apache.activemq.artemis.api.core.SimpleString HDR_SCHEDULED_DELIVERY_TIME
To be used with Scheduled Delivery.
-
HDR_DUPLICATE_DETECTION_ID
static final org.apache.activemq.artemis.api.core.SimpleString HDR_DUPLICATE_DETECTION_ID
To be used with duplicate detection.
-
HDR_LAST_VALUE_NAME
static final org.apache.activemq.artemis.api.core.SimpleString HDR_LAST_VALUE_NAME
To be used with Last value queues.
-
HDR_CONTENT_TYPE
static final org.apache.activemq.artemis.api.core.SimpleString HDR_CONTENT_TYPE
To define the mime-type of body messages. Mainly for stomp but it could be informed on any message for user purposes.
-
HDR_VALIDATED_USER
static final org.apache.activemq.artemis.api.core.SimpleString HDR_VALIDATED_USER
The name of the validated user who sent the message. Useful for auditing.
-
HDR_ROUTING_TYPE
static final org.apache.activemq.artemis.api.core.SimpleString HDR_ROUTING_TYPE
The Routing Type for this message. Ensures that this message is only routed to queues with matching routing type.
-
HDR_ORIG_ROUTING_TYPE
static final org.apache.activemq.artemis.api.core.SimpleString HDR_ORIG_ROUTING_TYPE
The original routing type of a message before getting transferred through DLQ or expiry
-
HDR_INGRESS_TIMESTAMP
static final org.apache.activemq.artemis.api.core.SimpleString HDR_INGRESS_TIMESTAMP
The time at which the message arrived at the broker.
-
HDR_PREFIX
static final org.apache.activemq.artemis.api.core.SimpleString HDR_PREFIX
The prefix used (if any) when sending this message. For protocols (e.g. STOMP) that need to track this and restore the prefix when the message is consumed.
-
DEFAULT_TYPE
static final byte DEFAULT_TYPE
- See Also:
- Constant Field Values
-
OBJECT_TYPE
static final byte OBJECT_TYPE
- See Also:
- Constant Field Values
-
TEXT_TYPE
static final byte TEXT_TYPE
- See Also:
- Constant Field Values
-
BYTES_TYPE
static final byte BYTES_TYPE
- See Also:
- Constant Field Values
-
MAP_TYPE
static final byte MAP_TYPE
- See Also:
- Constant Field Values
-
STREAM_TYPE
static final byte STREAM_TYPE
- See Also:
- Constant Field Values
-
EMBEDDED_TYPE
static final byte EMBEDDED_TYPE
The message will contain another message persisted through org.apache.activemq.artemis.spi.core.protocol.EmbedMessageUtil- See Also:
- Constant Field Values
-
LARGE_EMBEDDED_TYPE
static final byte LARGE_EMBEDDED_TYPE
This is to embedd Large Messages from other protocol- See Also:
- Constant Field Values
-
-
Method Detail
-
clearInternalProperties
default void clearInternalProperties()
-
hasScheduledDeliveryTime
default boolean hasScheduledDeliveryTime()
Search for the existence of the property: an implementor can save the message to be decoded, if possible.
-
getRoutingType
default org.apache.activemq.artemis.api.core.RoutingType getRoutingType()
-
setRoutingType
default Message setRoutingType(org.apache.activemq.artemis.api.core.RoutingType routingType)
-
getLastValueProperty
default org.apache.activemq.artemis.api.core.SimpleString getLastValueProperty()
-
setLastValueProperty
default Message setLastValueProperty(org.apache.activemq.artemis.api.core.SimpleString lastValueName)
-
getBodyInputStream
@Deprecated default java.io.InputStream getBodyInputStream()
Deprecated.do not use this, use through ICoreMessage or ClientMessage
-
getBodyBuffer
@Deprecated default org.apache.activemq.artemis.api.core.ActiveMQBuffer getBodyBuffer()
Deprecated.do not use this, use through ICoreMessage or ClientMessage Warning: if you need to read the content of a message use getDataBuffer(). This method is intended for when you want to make changes.
-
getType
@Deprecated default byte getType()
Deprecated.do not use this, use through ICoreMessage or ClientMessage
-
setType
@Deprecated default Message setType(byte type)
Deprecated.do not use this, use through ICoreMessage or ClientMessage
-
messageChanged
void messageChanged()
WARNING: Calling this method on a AMQPMessage will allow the non mutable part of the message to be modified.
-
getScheduledDeliveryTime
java.lang.Long getScheduledDeliveryTime()
Used to calculate what is the delivery time. Return null if not scheduled.
-
setScheduledDeliveryTime
default Message setScheduledDeliveryTime(java.lang.Long time)
-
getGroupID
default org.apache.activemq.artemis.api.core.SimpleString getGroupID()
-
setGroupID
default Message setGroupID(org.apache.activemq.artemis.api.core.SimpleString groupID)
-
setGroupID
default Message setGroupID(java.lang.String groupID)
-
getGroupSequence
default int getGroupSequence()
-
setGroupSequence
default Message setGroupSequence(int sequence)
-
getCorrelationID
default java.lang.Object getCorrelationID()
-
setCorrelationID
default Message setCorrelationID(java.lang.Object correlationID)
-
getReplyTo
org.apache.activemq.artemis.api.core.SimpleString getReplyTo()
-
setReplyTo
Message setReplyTo(org.apache.activemq.artemis.api.core.SimpleString address)
-
copy
Message copy()
It will generate a new instance of the message encode, being a deep copy, new properties, new everything
-
copy
Message copy(long newID)
It will generate a new instance of the message encode, being a deep copy, new properties, new everything
-
copy
default Message copy(long newID, boolean isExpiryOrDLQ)
It will generate a new instance of the message encode, being a deep copy, new properties, new everything
-
acceptsConsumer
default boolean acceptsConsumer(long uniqueConsumerID)
-
rejectConsumer
default void rejectConsumer(long uniqueConsumerID)
-
getMessageID
long getMessageID()
Returns the messageID.
The messageID is set when the message is handled by the server.
-
getProtocolName
java.lang.String getProtocolName()
-
setConnectionID
default Message setConnectionID(java.lang.String connectionID)
-
getConnectionID
default java.lang.String getConnectionID()
-
setMessageID
Message setMessageID(long id)
-
isLargeMessage
default boolean isLargeMessage()
-
getExpiration
long getExpiration()
Returns the expiration time of this message.
-
setExpiration
Message setExpiration(long expiration)
Sets the expiration of this message.- Parameters:
expiration
- expiration time
-
isExpired
default boolean isExpired()
Returns whether this message is expired or not.
-
getUserID
java.lang.Object getUserID()
This represents historically the JMSMessageID. We had in the past used this for the MessageID that was sent on core messages... later on when we added AMQP this name clashed with AMQPMessage.getUserID();- Returns:
- the user id
-
setUserID
Message setUserID(java.lang.Object userID)
-
getValidatedUserID
default java.lang.String getValidatedUserID()
-
setValidatedUserID
default Message setValidatedUserID(java.lang.String validatedUserID)
-
isDurable
boolean isDurable()
Returns whether this message is durable or not.
-
setDurable
Message setDurable(boolean durable)
Sets whether this message is durable or not.- Parameters:
durable
-true
to flag this message as durable,false
else
-
getPersister
org.apache.activemq.artemis.core.persistence.Persister<Message> getPersister()
-
getAddress
java.lang.String getAddress()
-
setAddress
Message setAddress(java.lang.String address)
Look atsetAddress(SimpleString)
for the doc.- Parameters:
address
-- Returns:
-
getAddressSimpleString
org.apache.activemq.artemis.api.core.SimpleString getAddressSimpleString()
-
setAddress
Message setAddress(org.apache.activemq.artemis.api.core.SimpleString address)
This will set the address on CoreMessage. Note for AMQPMessages: in AMQPMessages this will not really change the address on the message. Instead it will add a property on extraProperties which only transverse internally at the broker. Whatever you change here it won't affect anything towards the received message. If you wish to change AMQPMessages address you will have to do it directly at the AMQP Message, however beware that AMQPMessages are not supposed to be changed at the broker, so only do it if you know what you are doing.- Parameters:
address
-- Returns:
-
getTimestamp
long getTimestamp()
-
setTimestamp
Message setTimestamp(long timestamp)
-
getPriority
byte getPriority()
Returns the message priority.Values range from 0 (less priority) to 9 (more priority) inclusive.
-
setPriority
Message setPriority(byte priority)
Sets the message priority.Value must be between 0 and 9 inclusive.
- Parameters:
priority
- the new message priority
-
receiveBuffer
void receiveBuffer(io.netty.buffer.ByteBuf buffer)
Used to receive this message from an encoded medium buffer
-
sendBuffer
void sendBuffer(io.netty.buffer.ByteBuf buffer, int deliveryCount)
Used to send this message to an encoded medium buffer.- Parameters:
buffer
- the buffer used.deliveryCount
- Some protocols (AMQP) will have this as part of the message.
-
getPersistSize
int getPersistSize()
-
persist
void persist(org.apache.activemq.artemis.api.core.ActiveMQBuffer targetRecord)
-
reloadPersistence
void reloadPersistence(org.apache.activemq.artemis.api.core.ActiveMQBuffer record, org.apache.activemq.artemis.core.persistence.CoreMessageObjectPools pools)
-
reencode
default void reencode()
-
referenceOriginalMessage
default void referenceOriginalMessage(Message original, org.apache.activemq.artemis.api.core.SimpleString originalQueue)
-
getDuplicateIDBytes
default byte[] getDuplicateIDBytes()
it will translate a property named HDR_DUPLICATE_DETECTION_ID.- Returns:
-
putExtraBytesProperty
default Message putExtraBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key, byte[] value)
-
getExtraBytesProperty
default byte[] getExtraBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
removeExtraBytesProperty
default byte[] removeExtraBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getDuplicateProperty
default java.lang.Object getDuplicateProperty()
-
putBooleanProperty
Message putBooleanProperty(java.lang.String key, boolean value)
-
putByteProperty
Message putByteProperty(java.lang.String key, byte value)
-
putBytesProperty
Message putBytesProperty(java.lang.String key, byte[] value)
-
putShortProperty
Message putShortProperty(java.lang.String key, short value)
-
putCharProperty
Message putCharProperty(java.lang.String key, char value)
-
putIntProperty
Message putIntProperty(java.lang.String key, int value)
-
putLongProperty
Message putLongProperty(java.lang.String key, long value)
-
putFloatProperty
Message putFloatProperty(java.lang.String key, float value)
-
putDoubleProperty
Message putDoubleProperty(java.lang.String key, double value)
-
putBooleanProperty
Message putBooleanProperty(org.apache.activemq.artemis.api.core.SimpleString key, boolean value)
-
putByteProperty
Message putByteProperty(org.apache.activemq.artemis.api.core.SimpleString key, byte value)
-
putBytesProperty
Message putBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key, byte[] value)
-
putShortProperty
Message putShortProperty(org.apache.activemq.artemis.api.core.SimpleString key, short value)
-
putCharProperty
Message putCharProperty(org.apache.activemq.artemis.api.core.SimpleString key, char value)
-
putIntProperty
Message putIntProperty(org.apache.activemq.artemis.api.core.SimpleString key, int value)
-
putLongProperty
Message putLongProperty(org.apache.activemq.artemis.api.core.SimpleString key, long value)
-
putFloatProperty
Message putFloatProperty(org.apache.activemq.artemis.api.core.SimpleString key, float value)
-
putDoubleProperty
Message putDoubleProperty(org.apache.activemq.artemis.api.core.SimpleString key, double value)
-
putStringProperty
Message putStringProperty(java.lang.String key, java.lang.String value)
Puts a String property in this message.- Parameters:
key
- property namevalue
- property value
-
putObjectProperty
Message putObjectProperty(java.lang.String key, java.lang.Object value) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
putObjectProperty
Message putObjectProperty(org.apache.activemq.artemis.api.core.SimpleString key, java.lang.Object value) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
removeProperty
java.lang.Object removeProperty(java.lang.String key)
-
containsProperty
boolean containsProperty(java.lang.String key)
-
getBooleanProperty
java.lang.Boolean getBooleanProperty(java.lang.String key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getByteProperty
java.lang.Byte getByteProperty(java.lang.String key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getDoubleProperty
java.lang.Double getDoubleProperty(java.lang.String key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getIntProperty
java.lang.Integer getIntProperty(java.lang.String key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getLongProperty
java.lang.Long getLongProperty(java.lang.String key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getObjectProperty
java.lang.Object getObjectProperty(java.lang.String key)
-
getShortProperty
java.lang.Short getShortProperty(java.lang.String key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getFloatProperty
java.lang.Float getFloatProperty(java.lang.String key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getStringProperty
java.lang.String getStringProperty(java.lang.String key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getSimpleStringProperty
org.apache.activemq.artemis.api.core.SimpleString getSimpleStringProperty(java.lang.String key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getBytesProperty
byte[] getBytesProperty(java.lang.String key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
removeProperty
java.lang.Object removeProperty(org.apache.activemq.artemis.api.core.SimpleString key)
-
containsProperty
boolean containsProperty(org.apache.activemq.artemis.api.core.SimpleString key)
-
getBooleanProperty
java.lang.Boolean getBooleanProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getByteProperty
java.lang.Byte getByteProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getDoubleProperty
java.lang.Double getDoubleProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getIntProperty
java.lang.Integer getIntProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getLongProperty
java.lang.Long getLongProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getObjectPropertyForFilter
default java.lang.Object getObjectPropertyForFilter(org.apache.activemq.artemis.api.core.SimpleString key)
-
getObjectProperty
java.lang.Object getObjectProperty(org.apache.activemq.artemis.api.core.SimpleString key)
-
removeAnnotation
default java.lang.Object removeAnnotation(org.apache.activemq.artemis.api.core.SimpleString key)
-
getAnnotationString
default java.lang.String getAnnotationString(org.apache.activemq.artemis.api.core.SimpleString key)
-
getAnnotation
java.lang.Object getAnnotation(org.apache.activemq.artemis.api.core.SimpleString key)
-
setAnnotation
default Message setAnnotation(org.apache.activemq.artemis.api.core.SimpleString key, java.lang.Object value)
Callers must callreencode()
in order to be sent to clients
-
setBrokerProperty
default Message setBrokerProperty(org.apache.activemq.artemis.api.core.SimpleString key, java.lang.Object value)
To be called by the broker on ocasions such as DLQ and expiry. When the broker is adding additional properties.
-
getBrokerProperty
default java.lang.Object getBrokerProperty(org.apache.activemq.artemis.api.core.SimpleString key)
-
setIngressTimestamp
default Message setIngressTimestamp()
-
getIngressTimestamp
default java.lang.Long getIngressTimestamp()
-
getShortProperty
java.lang.Short getShortProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getFloatProperty
java.lang.Float getFloatProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getStringProperty
java.lang.String getStringProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getSimpleStringProperty
org.apache.activemq.artemis.api.core.SimpleString getSimpleStringProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
getBytesProperty
byte[] getBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key) throws org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException
-
putStringProperty
Message putStringProperty(org.apache.activemq.artemis.api.core.SimpleString key, org.apache.activemq.artemis.api.core.SimpleString value)
-
putStringProperty
Message putStringProperty(org.apache.activemq.artemis.api.core.SimpleString key, java.lang.String value)
-
getEncodeSize
int getEncodeSize()
Returns the size of the encoded message.
-
getWholeMessageSize
default long getWholeMessageSize()
Return an estimate of the size of the message on the wire. for LargeMessages this will contain whatever is needed to encode properties and the body size of large messages. For AMQP this will return the whole body size of the message as the body will contain all the data including properties.- Returns:
-
getPropertyNames
java.util.Set<org.apache.activemq.artemis.api.core.SimpleString> getPropertyNames()
Returns all the names of the properties for this message.
-
getRefCount
int getRefCount()
-
getUsage
int getUsage()
-
getDurableCount
int getDurableCount()
-
usageUp
int usageUp()
this method indicates usage by components such as large message or page cache. This method will cause large messages to be held longer after the ack happened for instance.
-
usageDown
int usageDown()
- Returns:
- See Also:
usageUp()
-
refUp
int refUp()
-
refDown
int refDown()
-
durableUp
int durableUp()
-
durableDown
int durableDown()
-
toMap
default java.util.Map<java.lang.String,java.lang.Object> toMap()
- Returns:
- Returns the message in Map form, useful when encoding to JSON
-
toMap
default java.util.Map<java.lang.String,java.lang.Object> toMap(int valueSizeLimit)
- Parameters:
valueSizeLimit
- that limits [] map values- Returns:
- Returns the message in Map form, useful when encoding to JSON
-
toPropertyMap
default java.util.Map<java.lang.String,java.lang.Object> toPropertyMap()
- Returns:
- Returns the message properties in Map form, useful when encoding to JSON
-
toPropertyMap
default java.util.Map<java.lang.String,java.lang.Object> toPropertyMap(int valueSizeLimit)
- Parameters:
valueSizeLimit
- that limits [] map values- Returns:
- Returns the message properties in Map form, useful when encoding to JSON
-
toCore
ICoreMessage toCore()
This should make you convert your message into Core format.
-
toCompositeData
default javax.management.openmbean.CompositeData toCompositeData(int fieldsLimit, int deliveryCount) throws javax.management.openmbean.OpenDataException
- Throws:
javax.management.openmbean.OpenDataException
-
toCore
ICoreMessage toCore(org.apache.activemq.artemis.core.persistence.CoreMessageObjectPools coreMessageObjectPools)
This should make you convert your message into Core format.
-
getMemoryEstimate
int getMemoryEstimate()
-
getPersistentSize
long getPersistentSize() throws org.apache.activemq.artemis.api.core.ActiveMQException
This is the size of the message when persisted on disk which is used for metrics tracking Note that even if the message itself is not persisted on disk (ie non-durable) this value is still used for metrics tracking If a normal message it will be the encoded message size If a large message it will be encoded message size + large message body size- Returns:
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQException
-
getOwner
java.lang.Object getOwner()
-
setOwner
void setOwner(java.lang.Object object)
-
getStringBody
default java.lang.String getStringBody()
-
getUserContext
java.lang.Object getUserContext(java.lang.Object key)
Used for user context data. Useful on interceptors.
-
setUserContext
void setUserContext(java.lang.Object key, java.lang.Object value)
Used for user context data. Useful on interceptors.
-
-