Interface ClientMessage

  • All Superinterfaces:
    ICoreMessage, Message

    public interface ClientMessage
    extends ICoreMessage
    A ClientMessage represents a message sent and/or received by ActiveMQ Artemis.
    • 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 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:
        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 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:
        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.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:
        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.ActiveMQException
        Saves 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.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:
        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
      • 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:
        getBodyBuffer in interface ICoreMessage
        Specified by:
        getBodyBuffer in interface Message
        Returns:
      • putBooleanProperty

        ClientMessage putBooleanProperty​(org.apache.activemq.artemis.api.core.SimpleString key,
                                         boolean value)
        Overridden from Message to enable fluent API
        Specified by:
        putBooleanProperty in interface Message
      • putByteProperty

        ClientMessage putByteProperty​(org.apache.activemq.artemis.api.core.SimpleString key,
                                      byte value)
        Overridden from Message to enable fluent API
        Specified by:
        putByteProperty in interface Message
      • putBytesProperty

        ClientMessage putBytesProperty​(org.apache.activemq.artemis.api.core.SimpleString key,
                                       byte[] value)
        Overridden from Message to enable fluent API
        Specified by:
        putBytesProperty in interface Message
      • putShortProperty

        ClientMessage putShortProperty​(org.apache.activemq.artemis.api.core.SimpleString key,
                                       short value)
        Overridden from Message to enable fluent API
        Specified by:
        putShortProperty in interface Message
      • putCharProperty

        ClientMessage putCharProperty​(org.apache.activemq.artemis.api.core.SimpleString key,
                                      char value)
        Overridden from Message to enable fluent API
        Specified by:
        putCharProperty in interface Message
      • putIntProperty

        ClientMessage putIntProperty​(org.apache.activemq.artemis.api.core.SimpleString key,
                                     int value)
        Overridden from Message to enable fluent API
        Specified by:
        putIntProperty in interface Message
      • putLongProperty

        ClientMessage putLongProperty​(org.apache.activemq.artemis.api.core.SimpleString key,
                                      long value)
        Overridden from Message to enable fluent API
        Specified by:
        putLongProperty in interface Message
      • putFloatProperty

        ClientMessage putFloatProperty​(org.apache.activemq.artemis.api.core.SimpleString key,
                                       float value)
        Overridden from Message to enable fluent API
        Specified by:
        putFloatProperty in interface Message
      • putDoubleProperty

        ClientMessage putDoubleProperty​(org.apache.activemq.artemis.api.core.SimpleString key,
                                        double value)
        Overridden from Message to enable fluent API
        Specified by:
        putDoubleProperty in interface Message
      • putStringProperty

        ClientMessage putStringProperty​(java.lang.String key,
                                        java.lang.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​(java.lang.String string)
        Overridden from Message to enable fluent API