Interface ClientMessage
-
- All Superinterfaces:
ICoreMessage,Message
public interface ClientMessage extends ICoreMessage
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
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, STREAM_TYPE, TEXT_TYPE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ClientMessageacknowledge()Acknowledges reception of this message.voidcheckCompletion()This can be optionally used to verify if the entire message has been received.org.apache.activemq.artemis.api.core.ActiveMQBuffergetBodyBuffer()The buffer to write the body.java.io.InputStreamgetBodyInputStream()Return the bodyInputStream for large messagesintgetBodySize()Returns the size (in bytes) of this message's bodyintgetDeliveryCount()Returns the number of times this message was delivered.ClientMessageindividualAcknowledge()Acknowledges reception of a single message.ClientMessageputBooleanProperty(java.lang.String key, boolean value)Overridden fromMessageto enable fluent APIClientMessageputBooleanProperty(org.apache.activemq.artemis.api.core.SimpleString key, boolean value)Overridden fromMessageto enable fluent APIClientMessageputByteProperty(java.lang.String key, byte value)Overridden fromMessageto enable fluent APIClientMessageputByteProperty(org.apache.activemq.artemis.api.core.SimpleString key, byte value)Overridden fromMessageto enable fluent APIClientMessageputBytesProperty(java.lang.String key, byte[] value)Overridden fromMessageto enable fluent APIClientMessageputBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key, byte[] value)Overridden fromMessageto enable fluent APIClientMessageputCharProperty(java.lang.String key, char value)Overridden fromMessageto enable fluent APIClientMessageputCharProperty(org.apache.activemq.artemis.api.core.SimpleString key, char value)Overridden fromMessageto enable fluent APIClientMessageputDoubleProperty(java.lang.String key, double value)Overridden fromMessageto enable fluent APIClientMessageputDoubleProperty(org.apache.activemq.artemis.api.core.SimpleString key, double value)Overridden fromMessageto enable fluent APIClientMessageputFloatProperty(java.lang.String key, float value)Overridden fromMessageto enable fluent APIClientMessageputFloatProperty(org.apache.activemq.artemis.api.core.SimpleString key, float value)Overridden fromMessageto enable fluent APIClientMessageputIntProperty(java.lang.String key, int value)Overridden fromMessageto enable fluent APIClientMessageputIntProperty(org.apache.activemq.artemis.api.core.SimpleString key, int value)Overridden fromMessageto enable fluent APIClientMessageputLongProperty(java.lang.String key, long value)Overridden fromMessageto enable fluent APIClientMessageputLongProperty(org.apache.activemq.artemis.api.core.SimpleString key, long value)Overridden fromMessageto enable fluent APIClientMessageputShortProperty(java.lang.String key, short value)Overridden fromMessageto enable fluent APIClientMessageputShortProperty(org.apache.activemq.artemis.api.core.SimpleString key, short value)Overridden fromMessageto enable fluent APIClientMessageputStringProperty(java.lang.String key, java.lang.String value)Overridden fromMessageto enable fluent APIvoidsaveToOutputStream(java.io.OutputStream out)Saves the content of the message to the OutputStream.ClientMessagesetBodyInputStream(java.io.InputStream bodyInputStream)Sets the body's IntputStream.ClientMessagesetDeliveryCount(int deliveryCount)Sets the delivery count for this message.ClientMessagesetOutputStream(java.io.OutputStream out)Sets the OutputStream that will receive the content of a message received in a non blocking way.booleanwaitOutputStreamCompletion(long timeMilliseconds)Wait the outputStream completion of the message.ClientMessagewriteBodyBufferBytes(byte[] bytes)Overridden fromMessageto enable fluent APIClientMessagewriteBodyBufferString(java.lang.String string)Overridden fromMessageto enable fluent API-
Methods inherited from interface org.apache.activemq.artemis.api.core.ICoreMessage
getBodyBufferSize, getBuffer, getDataBuffer, getEndOfBodyPosition, getHeadersAndPropertiesEncodeSize, getLargeBodyReader, getReadOnlyBodyBuffer, getType, isServerMessage, moveHeadersAndProperties, receiveBuffer_1X, sendBuffer_1X, setBuffer, setType, toMap
-
Methods inherited from interface org.apache.activemq.artemis.api.core.Message
acceptsConsumer, 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, 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, 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, setPriority, setReplyTo, setRoutingType, setScheduledDeliveryTime, setTimestamp, setUserContext, setUserID, setValidatedUserID, toCompositeData, toCore, toCore, toMap, toPropertyMap, toPropertyMap, usageDown, usageUp
-
-
-
-
Method Detail
-
getDeliveryCount
int getDeliveryCount()
Returns the number of times this message was delivered.
-
setDeliveryCount
ClientMessage setDeliveryCount(int deliveryCount)
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
ClientMessage acknowledge() throws org.apache.activemq.artemis.api.core.ActiveMQException
Acknowledges reception of this message.If the session responsible to acknowledge this message has
autoCommitAcksset totrue, the transaction will automatically commit the current transaction. Otherwise, this acknowledgement will not be committed until the client commits the session transaction.- Throws:
org.apache.activemq.artemis.api.core.ActiveMQException- if an error occurred while acknowledging the message.- See Also:
ClientSession.isAutoCommitAcks()
-
individualAcknowledge
ClientMessage individualAcknowledge() throws org.apache.activemq.artemis.api.core.ActiveMQException
Acknowledges reception of a single message.If the session responsible to acknowledge this message has
autoCommitAcksset totrue, the transaction will automatically commit the current transaction. Otherwise, this acknowledgement will not be committed until the client commits the session transaction.- Throws:
org.apache.activemq.artemis.api.core.ActiveMQException- if an error occurred while acknowledging the message.- See Also:
ClientSession.isAutoCommitAcks()
-
checkCompletion
void checkCompletion() throws org.apache.activemq.artemis.api.core.ActiveMQExceptionThis 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:
org.apache.activemq.artemis.api.core.ActiveMQException
-
getBodySize
int getBodySize()
Returns the size (in bytes) of this message's body
-
setOutputStream
ClientMessage setOutputStream(java.io.OutputStream out) throws org.apache.activemq.artemis.api.core.ActiveMQException
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:
org.apache.activemq.artemis.api.core.ActiveMQException
-
saveToOutputStream
void saveToOutputStream(java.io.OutputStream out) throws org.apache.activemq.artemis.api.core.ActiveMQExceptionSaves the content of the message to the OutputStream. It will block until the entire content is transferred to the OutputStream.- Throws:
org.apache.activemq.artemis.api.core.ActiveMQException
-
waitOutputStreamCompletion
boolean waitOutputStreamCompletion(long timeMilliseconds) throws org.apache.activemq.artemis.api.core.ActiveMQExceptionWait 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:
org.apache.activemq.artemis.api.core.ActiveMQException
-
setBodyInputStream
ClientMessage setBodyInputStream(java.io.InputStream bodyInputStream)
Sets the body's IntputStream.
This method is used when sending large messages- Returns:
- this ClientMessage
-
getBodyInputStream
java.io.InputStream getBodyInputStream()
Return the bodyInputStream for large messages- Specified by:
getBodyInputStreamin interfaceICoreMessage- Specified by:
getBodyInputStreamin interfaceMessage- Returns:
-
getBodyBuffer
org.apache.activemq.artemis.api.core.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:
getBodyBufferin interfaceICoreMessage- Specified by:
getBodyBufferin interfaceMessage- Returns:
-
putBooleanProperty
ClientMessage putBooleanProperty(org.apache.activemq.artemis.api.core.SimpleString key, boolean value)
Overridden fromMessageto enable fluent API- Specified by:
putBooleanPropertyin interfaceMessage
-
putBooleanProperty
ClientMessage putBooleanProperty(java.lang.String key, boolean value)
Overridden fromMessageto enable fluent API- Specified by:
putBooleanPropertyin interfaceMessage
-
putByteProperty
ClientMessage putByteProperty(org.apache.activemq.artemis.api.core.SimpleString key, byte value)
Overridden fromMessageto enable fluent API- Specified by:
putBytePropertyin interfaceMessage
-
putByteProperty
ClientMessage putByteProperty(java.lang.String key, byte value)
Overridden fromMessageto enable fluent API- Specified by:
putBytePropertyin interfaceMessage
-
putBytesProperty
ClientMessage putBytesProperty(org.apache.activemq.artemis.api.core.SimpleString key, byte[] value)
Overridden fromMessageto enable fluent API- Specified by:
putBytesPropertyin interfaceMessage
-
putBytesProperty
ClientMessage putBytesProperty(java.lang.String key, byte[] value)
Overridden fromMessageto enable fluent API- Specified by:
putBytesPropertyin interfaceMessage
-
putShortProperty
ClientMessage putShortProperty(org.apache.activemq.artemis.api.core.SimpleString key, short value)
Overridden fromMessageto enable fluent API- Specified by:
putShortPropertyin interfaceMessage
-
putShortProperty
ClientMessage putShortProperty(java.lang.String key, short value)
Overridden fromMessageto enable fluent API- Specified by:
putShortPropertyin interfaceMessage
-
putCharProperty
ClientMessage putCharProperty(org.apache.activemq.artemis.api.core.SimpleString key, char value)
Overridden fromMessageto enable fluent API- Specified by:
putCharPropertyin interfaceMessage
-
putCharProperty
ClientMessage putCharProperty(java.lang.String key, char value)
Overridden fromMessageto enable fluent API- Specified by:
putCharPropertyin interfaceMessage
-
putIntProperty
ClientMessage putIntProperty(org.apache.activemq.artemis.api.core.SimpleString key, int value)
Overridden fromMessageto enable fluent API- Specified by:
putIntPropertyin interfaceMessage
-
putIntProperty
ClientMessage putIntProperty(java.lang.String key, int value)
Overridden fromMessageto enable fluent API- Specified by:
putIntPropertyin interfaceMessage
-
putLongProperty
ClientMessage putLongProperty(org.apache.activemq.artemis.api.core.SimpleString key, long value)
Overridden fromMessageto enable fluent API- Specified by:
putLongPropertyin interfaceMessage
-
putLongProperty
ClientMessage putLongProperty(java.lang.String key, long value)
Overridden fromMessageto enable fluent API- Specified by:
putLongPropertyin interfaceMessage
-
putFloatProperty
ClientMessage putFloatProperty(org.apache.activemq.artemis.api.core.SimpleString key, float value)
Overridden fromMessageto enable fluent API- Specified by:
putFloatPropertyin interfaceMessage
-
putFloatProperty
ClientMessage putFloatProperty(java.lang.String key, float value)
Overridden fromMessageto enable fluent API- Specified by:
putFloatPropertyin interfaceMessage
-
putDoubleProperty
ClientMessage putDoubleProperty(org.apache.activemq.artemis.api.core.SimpleString key, double value)
Overridden fromMessageto enable fluent API- Specified by:
putDoublePropertyin interfaceMessage
-
putDoubleProperty
ClientMessage putDoubleProperty(java.lang.String key, double value)
Overridden fromMessageto enable fluent API- Specified by:
putDoublePropertyin interfaceMessage
-
putStringProperty
ClientMessage putStringProperty(java.lang.String key, java.lang.String value)
Overridden fromMessageto enable fluent API- Specified by:
putStringPropertyin interfaceMessage- Parameters:
key- property namevalue- property value
-
writeBodyBufferBytes
ClientMessage writeBodyBufferBytes(byte[] bytes)
Overridden fromMessageto enable fluent API
-
writeBodyBufferString
ClientMessage writeBodyBufferString(java.lang.String string)
Overridden fromMessageto enable fluent API
-
-