Interface ClientMessage
- All Superinterfaces:
ICoreMessage
,Message
A ClientMessage represents a message sent and/or received by ActiveMQ Artemis.
-
Field Summary
Fields inherited from interface org.apache.activemq.artemis.api.core.Message
AMQP_PROPERTY_PREDICATE, BYTES_TYPE, DEFAULT_TYPE, EMBEDDED_TYPE, HDR_ACTUAL_EXPIRY_TIME, HDR_BRIDGE_DUPLICATE_ID, HDR_CONTENT_TYPE, HDR_DUPLICATE_DETECTION_ID, HDR_GROUP_ID, HDR_GROUP_SEQUENCE, HDR_INGRESS_TIMESTAMP, HDR_LARGE_BODY_SIZE, HDR_LARGE_COMPRESSED, HDR_LAST_VALUE_NAME, HDR_ORIG_MESSAGE_ID, HDR_ORIG_ROUTING_TYPE, HDR_ORIGINAL_ADDRESS, HDR_ORIGINAL_QUEUE, HDR_PREFIX, HDR_ROUTE_TO_ACK_IDS, HDR_ROUTE_TO_IDS, HDR_ROUTING_TYPE, HDR_SCALEDOWN_TO_IDS, HDR_SCHEDULED_DELIVERY_TIME, HDR_VALIDATED_USER, INTERNAL_PROPERTY_NAMES_PREDICATE, LARGE_EMBEDDED_TYPE, MAP_TYPE, memoryOffset, OBJECT_TYPE, PREFIX_AMQP_ANNOTATIONS, STREAM_TYPE, TEXT_TYPE
-
Method Summary
Modifier and TypeMethodDescriptionAcknowledges reception of this message.void
This can be optionally used to verify if the entire message has been received.The buffer to write the body.Return the bodyInputStream for large messagesint
Returns the size (in bytes) of this message's bodyint
Returns the number of times this message was delivered.Acknowledges reception of a single message.putBooleanProperty
(String key, boolean value) Overridden fromMessage
to enable fluent APIputBooleanProperty
(SimpleString key, boolean value) Overridden fromMessage
to enable fluent APIputByteProperty
(String key, byte value) Overridden fromMessage
to enable fluent APIputByteProperty
(SimpleString key, byte value) Overridden fromMessage
to enable fluent APIputBytesProperty
(String key, byte[] value) Overridden fromMessage
to enable fluent APIputBytesProperty
(SimpleString key, byte[] value) Overridden fromMessage
to enable fluent APIputCharProperty
(String key, char value) Overridden fromMessage
to enable fluent APIputCharProperty
(SimpleString key, char value) Overridden fromMessage
to enable fluent APIputDoubleProperty
(String key, double value) Overridden fromMessage
to enable fluent APIputDoubleProperty
(SimpleString key, double value) Overridden fromMessage
to enable fluent APIputFloatProperty
(String key, float value) Overridden fromMessage
to enable fluent APIputFloatProperty
(SimpleString key, float value) Overridden fromMessage
to enable fluent APIputIntProperty
(String key, int value) Overridden fromMessage
to enable fluent APIputIntProperty
(SimpleString key, int value) Overridden fromMessage
to enable fluent APIputLongProperty
(String key, long value) Overridden fromMessage
to enable fluent APIputLongProperty
(SimpleString key, long value) Overridden fromMessage
to enable fluent APIputShortProperty
(String key, short value) Overridden fromMessage
to enable fluent APIputShortProperty
(SimpleString key, short value) Overridden fromMessage
to enable fluent APIputStringProperty
(String key, String value) Overridden fromMessage
to enable fluent APIvoid
Saves the content of the message to the OutputStream.setBodyInputStream
(InputStream bodyInputStream) Sets the body's IntputStream.setDeliveryCount
(int deliveryCount) Sets the delivery count for this message.Sets the OutputStream that will receive the content of a message received in a non blocking way.boolean
waitOutputStreamCompletion
(long timeMilliseconds) Wait the outputStream completion of the message.writeBodyBufferBytes
(byte[] bytes) Overridden fromMessage
to enable fluent APIwriteBodyBufferString
(String string) Overridden fromMessage
to enable fluent APIMethods inherited from interface org.apache.activemq.artemis.api.core.ICoreMessage
getBodyBufferSize, getBuffer, getDataBuffer, getEndOfBodyPosition, getHeadersAndPropertiesEncodeSize, getLargeBodyReader, getReadOnlyBodyBuffer, getType, isConfirmed, isServerMessage, moveHeadersAndProperties, receiveBuffer_1X, sendBuffer_1X, setBuffer, setConfirmed, setType, toMap
Methods inherited from interface org.apache.activemq.artemis.api.core.Message
acceptsConsumer, clearAMQPProperties, clearInternalProperties, containsProperty, containsProperty, copy, copy, copy, durableDown, durableUp, getAddress, getAddressSimpleString, getAnnotation, getAnnotationString, getBooleanProperty, getBooleanProperty, getBrokerProperty, getByteProperty, getByteProperty, getBytesProperty, getBytesProperty, getConnectionID, getCorrelationID, getDoubleProperty, getDoubleProperty, getDuplicateIDBytes, getDuplicateProperty, getDurableCount, getEncodeSize, getExpiration, getExtraBytesProperty, getFloatProperty, getFloatProperty, getGroupID, getGroupSequence, getIngressTimestamp, getIntProperty, getIntProperty, getLastValueProperty, getLongProperty, getLongProperty, getMemoryEstimate, getMessageID, getObjectProperty, getObjectProperty, getObjectPropertyForFilter, getOriginalEstimate, getOwner, getPersistentSize, getPersister, getPersistSize, getPriority, getPropertyNames, getProtocolName, getRefCount, getReplyTo, getRoutingType, getScheduledDeliveryTime, getShortProperty, getShortProperty, getSimpleStringProperty, getSimpleStringProperty, getStringBody, getStringProperty, getStringProperty, getTimestamp, getUsage, getUserContext, getUserID, getValidatedUserID, getWholeMessageSize, hasScheduledDeliveryTime, isDurable, isExpired, isLargeMessage, isPaged, messageChanged, persist, putExtraBytesProperty, putObjectProperty, putObjectProperty, putStringProperty, putStringProperty, receiveBuffer, reencode, refDown, referenceOriginalMessage, refUp, rejectConsumer, reloadPersistence, removeAnnotation, removeExtraBytesProperty, removeProperty, removeProperty, sendBuffer, setAddress, setAddress, setAnnotation, setBrokerProperty, setConnectionID, setCorrelationID, setDurable, setExpiration, setGroupID, setGroupID, setGroupSequence, setIngressTimestamp, setLastValueProperty, setMessageID, setOwner, setPaged, setPriority, setReplyTo, setRoutingType, setScheduledDeliveryTime, setTimestamp, setUserContext, setUserID, setValidatedUserID, toCompositeData, toCore, toCore, toMap, toPropertyMap, toPropertyMap, usageDown, usageUp
-
Method Details
-
getDeliveryCount
int getDeliveryCount()Returns the number of times this message was delivered. -
setDeliveryCount
Sets the delivery count for this message.This method is not meant to be called by ActiveMQ Artemis clients.
- Parameters:
deliveryCount
- message delivery count- Returns:
- this ClientMessage
-
acknowledge
Acknowledges reception of this message.If the session responsible to acknowledge this message has
autoCommitAcks
set totrue
, the transaction will automatically commit the current transaction. Otherwise, this acknowledgement will not be committed until the client commits the session transaction.- Throws:
ActiveMQException
- if an error occurred while acknowledging the message.- See Also:
-
individualAcknowledge
Acknowledges reception of a single message.If the session responsible to acknowledge this message has
autoCommitAcks
set totrue
, the transaction will automatically commit the current transaction. Otherwise, this acknowledgement will not be committed until the client commits the session transaction.- Throws:
ActiveMQException
- if an error occurred while acknowledging the message.- See Also:
-
checkCompletion
This can be optionally used to verify if the entire message has been received. It won't have any effect on regular messages but it may be helpful on large messages. The use case for this is to make sure there won't be an exception while getting the buffer. Using getBodyBuffer directly would have the same effect but you could get a Runtime non checked Exception instead- Throws:
ActiveMQException
-
getBodySize
int getBodySize()Returns the size (in bytes) of this message's body -
setOutputStream
Sets the OutputStream that will receive the content of a message received in a non blocking way.
This method is used when consuming large messages- Returns:
- this ClientMessage
- Throws:
ActiveMQException
-
saveToOutputStream
Saves the content of the message to the OutputStream. It will block until the entire content is transferred to the OutputStream.- Throws:
ActiveMQException
-
waitOutputStreamCompletion
Wait the outputStream completion of the message. This method is used when consuming large messages- Parameters:
timeMilliseconds
- - 0 means wait forever- Returns:
- true if it reached the end
- Throws:
ActiveMQException
-
setBodyInputStream
Sets the body's IntputStream.
This method is used when sending large messages- Returns:
- this ClientMessage
-
getBodyInputStream
InputStream getBodyInputStream()Return the bodyInputStream for large messages- Specified by:
getBodyInputStream
in interfaceICoreMessage
- Specified by:
getBodyInputStream
in interfaceMessage
- Returns:
-
getBodyBuffer
ActiveMQBuffer getBodyBuffer()The buffer to write the body. Warning: If you just want to read the content of a message, use getDataBuffer() or getReadOnlyBuffer();- Specified by:
getBodyBuffer
in interfaceICoreMessage
- Specified by:
getBodyBuffer
in interfaceMessage
- Returns:
-
putBooleanProperty
Overridden fromMessage
to enable fluent API- Specified by:
putBooleanProperty
in interfaceMessage
-
putBooleanProperty
Overridden fromMessage
to enable fluent API- Specified by:
putBooleanProperty
in interfaceMessage
-
putByteProperty
Overridden fromMessage
to enable fluent API- Specified by:
putByteProperty
in interfaceMessage
-
putByteProperty
Overridden fromMessage
to enable fluent API- Specified by:
putByteProperty
in interfaceMessage
-
putBytesProperty
Overridden fromMessage
to enable fluent API- Specified by:
putBytesProperty
in interfaceMessage
-
putBytesProperty
Overridden fromMessage
to enable fluent API- Specified by:
putBytesProperty
in interfaceMessage
-
putShortProperty
Overridden fromMessage
to enable fluent API- Specified by:
putShortProperty
in interfaceMessage
-
putShortProperty
Overridden fromMessage
to enable fluent API- Specified by:
putShortProperty
in interfaceMessage
-
putCharProperty
Overridden fromMessage
to enable fluent API- Specified by:
putCharProperty
in interfaceMessage
-
putCharProperty
Overridden fromMessage
to enable fluent API- Specified by:
putCharProperty
in interfaceMessage
-
putIntProperty
Overridden fromMessage
to enable fluent API- Specified by:
putIntProperty
in interfaceMessage
-
putIntProperty
Overridden fromMessage
to enable fluent API- Specified by:
putIntProperty
in interfaceMessage
-
putLongProperty
Overridden fromMessage
to enable fluent API- Specified by:
putLongProperty
in interfaceMessage
-
putLongProperty
Overridden fromMessage
to enable fluent API- Specified by:
putLongProperty
in interfaceMessage
-
putFloatProperty
Overridden fromMessage
to enable fluent API- Specified by:
putFloatProperty
in interfaceMessage
-
putFloatProperty
Overridden fromMessage
to enable fluent API- Specified by:
putFloatProperty
in interfaceMessage
-
putDoubleProperty
Overridden fromMessage
to enable fluent API- Specified by:
putDoubleProperty
in interfaceMessage
-
putDoubleProperty
Overridden fromMessage
to enable fluent API- Specified by:
putDoubleProperty
in interfaceMessage
-
putStringProperty
Overridden fromMessage
to enable fluent API- Specified by:
putStringProperty
in interfaceMessage
- Parameters:
key
- property namevalue
- property value
-
writeBodyBufferBytes
Overridden fromMessage
to enable fluent API -
writeBodyBufferString
Overridden fromMessage
to enable fluent API
-