org.apache.activemq.artemis.api.core.client

## 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_LARGE_BODY_SIZE, HDR_LARGE_COMPRESSED, HDR_LAST_VALUE_NAME, HDR_ORIG_MESSAGE_ID, 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 and Description
    --- | ---
    `ClientMessage` | `acknowledge()` Acknowledges reception of this message.
    `void` | `checkCompletion()` This can be optionally used to verify if the entire message has been received.
    `ActiveMQBuffer` | `getBodyBuffer()` The buffer to write the body.
    `InputStream` | `getBodyInputStream()` Return the bodyInputStream for large messages
    `int` | `getBodySize()` Returns the size (in bytes) of this message's body
    `int` | `getDeliveryCount()` Returns the number of times this message was delivered.
    `ClientMessage` | `individualAcknowledge()` Acknowledges reception of a single message.
    `ClientMessage` | `putBooleanProperty(SimpleString key, boolean value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putBooleanProperty(String key, boolean value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putByteProperty(SimpleString key, byte value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putByteProperty(String key, byte value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putBytesProperty(SimpleString key, byte[] value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putBytesProperty(String key, byte[] value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putCharProperty(SimpleString key, char value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putCharProperty(String key, char value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putDoubleProperty(SimpleString key, double value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putDoubleProperty(String key, double value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putFloatProperty(SimpleString key, float value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putFloatProperty(String key, float value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putIntProperty(SimpleString key, int value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putIntProperty(String key, int value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putLongProperty(SimpleString key, long value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putLongProperty(String key, long value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putShortProperty(SimpleString key, short value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putShortProperty(String key, short value)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `putStringProperty(String key, String value)` Overridden from `Message` to enable fluent API
    `void` | `saveToOutputStream(OutputStream out)` Saves the content of the message to the OutputStream.
    `ClientMessage` | `setBodyInputStream(InputStream bodyInputStream)` Sets the body's IntputStream.
    `ClientMessage` | `setDeliveryCount(int deliveryCount)` Sets the delivery count for this message.
    `ClientMessage` | `setOutputStream(OutputStream out)` 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.
    `ClientMessage` | `writeBodyBufferBytes(byte[] bytes)` Overridden from `Message` to enable fluent API
    `ClientMessage` | `writeBodyBufferString(String string)` Overridden from `Message` to enable fluent API

    - ### Methods inherited from interface org.apache.activemq.artemis.api.core.ICoreMessage

      `getBodyBufferSize, getDataBuffer, getEndOfBodyPosition, getHeadersAndPropertiesEncodeSize, getLargeBodyReader, getReadOnlyBodyBuffer, getType, isServerMessage, moveHeadersAndProperties, receiveBuffer_1X, sendBuffer_1X, setType, toMap`

    - ### Methods inherited from interface org.apache.activemq.artemis.api.core.Message

      `acceptsConsumer, clearInternalProperties, containsProperty, containsProperty, copy, copy, durableDown, durableUp, getAddress, getAddressSimpleString, getAnnotation, getAnnotationString, getBooleanProperty, getBooleanProperty, getBrokerProperty, getBuffer, getByteProperty, getByteProperty, getBytesProperty, getBytesProperty, getConnectionID, getCorrelationID, getDoubleProperty, getDoubleProperty, getDuplicateIDBytes, getDuplicateProperty, getDurableCount, getEncodeSize, getExpiration, getExtraBytesProperty, getFloatProperty, getFloatProperty, getGroupID, getGroupSequence, getIntProperty, getIntProperty, getLastValueProperty, getLongProperty, getLongProperty, getMemoryEstimate, getMessageID, getObjectProperty, getObjectProperty, getObjectPropertyForFilter, getPersistentSize, getPersister, getPersistSize, getPriority, getPropertyNames, getRefCount, getReplyTo, getRoutingType, getScheduledDeliveryTime, getShortProperty, getShortProperty, getSimpleStringProperty, getSimpleStringProperty, getStringProperty, getStringProperty, getTimestamp, getUsage, getUserID, getValidatedUserID, hasScheduledDeliveryTime, isDurable, isExpired, isLargeMessage, messageChanged, persist, putExtraBytesProperty, putObjectProperty, putObjectProperty, putStringProperty, putStringProperty, receiveBuffer, reencode, refDown, referenceOriginalMessage, refUp, rejectConsumer, releaseBuffer, reloadPersistence, removeAnnotation, removeExtraBytesProperty, removeProperty, removeProperty, sendBuffer, setAddress, setAddress, setAnnotation, setBrokerProperty, setBuffer, setConnectionID, setCorrelationID, setDurable, setExpiration, setGroupID, setGroupID, setGroupSequence, setLastValueProperty, setMessageID, setPriority, setReplyTo, setRoutingType, setScheduledDeliveryTime, setTimestamp, setUserID, setValidatedUserID, toCore, toCore, 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 ActiveMQException

      Acknowledges reception of this message.

      If the session responsible to acknowledge this message has `autoCommitAcks` set to `true`, 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:
        `ClientSession.isAutoCommitAcks()`

    - #### individualAcknowledge

          ClientMessage individualAcknowledge()
                                       throws ActiveMQException

      Acknowledges reception of a single message.

      If the session responsible to acknowledge this message has `autoCommitAcks` set to `true`, 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:
        `ClientSession.isAutoCommitAcks()`

    - #### checkCompletion

          void checkCompletion()
                        throws ActiveMQException

      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

          ClientMessage setOutputStream(OutputStream out)
                                 throws 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:
        `ActiveMQException`

    - #### saveToOutputStream

          void saveToOutputStream(OutputStream out)
                           throws ActiveMQException

      Saves the content of the message to the OutputStream. It will block until the entire content is transferred to the OutputStream.
      Throws:
        `ActiveMQException`

    - #### waitOutputStreamCompletion

          boolean waitOutputStreamCompletion(long timeMilliseconds)
                                      throws ActiveMQException

      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

          ClientMessage setBodyInputStream(InputStream bodyInputStream)

      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 interface `ICoreMessage`
      Specified by:
        `getBodyInputStream` in interface `Message`
      Returns:

    - #### getBodyBuffer

          ActiveMQBuffer getBodyBuffer()

      The buffer to write the body.
      Specified by:
        `getBodyBuffer` in interface `ICoreMessage`
      Specified by:
        `getBodyBuffer` in interface `Message`
      Returns:

    - #### putBooleanProperty

          ClientMessage putBooleanProperty(SimpleString key,
                                           boolean value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putBooleanProperty` in interface `Message`

    - #### putBooleanProperty

          ClientMessage putBooleanProperty(String key,
                                           boolean value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putBooleanProperty` in interface `Message`

    - #### putByteProperty

          ClientMessage putByteProperty(SimpleString key,
                                        byte value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putByteProperty` in interface `Message`

    - #### putByteProperty

          ClientMessage putByteProperty(String key,
                                        byte value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putByteProperty` in interface `Message`

    - #### putBytesProperty

          ClientMessage putBytesProperty(SimpleString key,
                                         byte[] value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putBytesProperty` in interface `Message`

    - #### putBytesProperty

          ClientMessage putBytesProperty(String key,
                                         byte[] value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putBytesProperty` in interface `Message`

    - #### putShortProperty

          ClientMessage putShortProperty(SimpleString key,
                                         short value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putShortProperty` in interface `Message`

    - #### putShortProperty

          ClientMessage putShortProperty(String key,
                                         short value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putShortProperty` in interface `Message`

    - #### putCharProperty

          ClientMessage putCharProperty(SimpleString key,
                                        char value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putCharProperty` in interface `Message`

    - #### putCharProperty

          ClientMessage putCharProperty(String key,
                                        char value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putCharProperty` in interface `Message`

    - #### putIntProperty

          ClientMessage putIntProperty(SimpleString key,
                                       int value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putIntProperty` in interface `Message`

    - #### putIntProperty

          ClientMessage putIntProperty(String key,
                                       int value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putIntProperty` in interface `Message`

    - #### putLongProperty

          ClientMessage putLongProperty(SimpleString key,
                                        long value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putLongProperty` in interface `Message`

    - #### putLongProperty

          ClientMessage putLongProperty(String key,
                                        long value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putLongProperty` in interface `Message`

    - #### putFloatProperty

          ClientMessage putFloatProperty(SimpleString key,
                                         float value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putFloatProperty` in interface `Message`

    - #### putFloatProperty

          ClientMessage putFloatProperty(String key,
                                         float value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putFloatProperty` in interface `Message`

    - #### putDoubleProperty

          ClientMessage putDoubleProperty(SimpleString key,
                                          double value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putDoubleProperty` in interface `Message`

    - #### putDoubleProperty

          ClientMessage putDoubleProperty(String key,
                                          double value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putDoubleProperty` in interface `Message`

    - #### putStringProperty

          ClientMessage putStringProperty(String key,
                                          String value)

      Overridden from `Message` to enable fluent API
      Specified by:
        `putStringProperty` in interface `Message`
      Parameters:
        `key` - property name
        `value` - property value

    - #### writeBodyBufferBytes

          ClientMessage writeBodyBufferBytes(byte[] bytes)

      Overridden from `Message` to enable fluent API

    - #### writeBodyBufferString

          ClientMessage writeBodyBufferString(String string)

      Overridden from `Message` to enable fluent API

Copyright © 2020 The Apache Software Foundation. All rights reserved.