org.apache.activemq.artemis.jms.client

## Class ActiveMQMessage

- java.lang.Object
- - org.apache.activemq.artemis.jms.client.ActiveMQMessage

- All Implemented Interfaces:
    javax.jms.Message
  Direct Known Subclasses:
    ActiveMQBytesMessage, ActiveMQMapMessage, ActiveMQObjectMessage, ActiveMQStreamMessage, ActiveMQTextMessage

      public class ActiveMQMessage
      extends Object
      implements javax.jms.Message

  ActiveMQ Artemis implementation of a JMS Message.
  JMS Messages only live on the client side - the server only deals with MessageImpl instances

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ClientMessage` | `message`
    `protected boolean` | `propertiesReadOnly`
    `protected boolean` | `readOnly`
    `static byte` | `TYPE`

    - ### Fields inherited from interface javax.jms.Message

      `DEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `ActiveMQMessage()`
    `protected` | `ActiveMQMessage(byte type, ClientSession session)`
    `` | `ActiveMQMessage(ClientMessage message, ClientSession session)` Constructor for when receiving a message from the server
    `protected` | `ActiveMQMessage(ClientSession session)`
    `protected` | `ActiveMQMessage(javax.jms.Message foreign, byte type, ClientSession session)`
    `` | `ActiveMQMessage(javax.jms.Message foreign, ClientSession session)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `acknowledge()`
    `void` | `checkBuffer()`
    `protected void` | `checkRead()`
    `protected void` | `checkWrite()`
    `void` | `clearBody()`
    `void` | `clearProperties()`
    `static CompositeData` | `coreCompositeTypeToJMSCompositeType(CompositeDataSupport data)`
    `static Map<String,Object>` | `coreMaptoJMSMap(Map<String,Object> coreMessage)`
    `static ActiveMQMessage` | `createMessage(ClientMessage message, ClientSession session)`
    `static ActiveMQMessage` | `createMessage(ClientMessage message, ClientSession session, ConnectionFactoryOptions options)`
    `void` | `doBeforeReceive()`
    `void` | `doBeforeSend()`
    `<T> T` | `getBody(Class<T> c)`
    `protected <T> T` | `getBodyInternal(Class<T> c)`
    `boolean` | `getBooleanProperty(String name)`
    `byte` | `getByteProperty(String name)`
    `ClientMessage` | `getCoreMessage()`
    `double` | `getDoubleProperty(String name)`
    `float` | `getFloatProperty(String name)`
    `int` | `getIntProperty(String name)`
    `String` | `getJMSCorrelationID()`
    `byte[]` | `getJMSCorrelationIDAsBytes()`
    `int` | `getJMSDeliveryMode()`
    `long` | `getJMSDeliveryTime()`
    `javax.jms.Destination` | `getJMSDestination()`
    `long` | `getJMSExpiration()`
    `String` | `getJMSMessageID()`
    `int` | `getJMSPriority()`
    `boolean` | `getJMSRedelivered()`
    `javax.jms.Destination` | `getJMSReplyTo()`
    `long` | `getJMSTimestamp()`
    `String` | `getJMSType()`
    `long` | `getLongProperty(String name)`
    `Object` | `getObjectProperty(String name)`
    `Enumeration` | `getPropertyNames()`
    `short` | `getShortProperty(String name)`
    `String` | `getStringProperty(String name)`
    `byte` | `getType()`
    `protected boolean` | `hasNoBody()` Helper method for `isBodyAssignableTo(Class)`.
    `boolean` | `isBodyAssignableTo(Class c)`
    `boolean` | `propertyExists(String name)`
    `void` | `resetMessageID(String newMsgID)`
    `void` | `saveToOutputStream(OutputStream output)`
    `void` | `setBooleanProperty(String name, boolean value)`
    `void` | `setByteProperty(String name, byte value)`
    `void` | `setClientAcknowledge()`
    `void` | `setDoubleProperty(String name, double value)`
    `void` | `setFloatProperty(String name, float value)`
    `void` | `setIndividualAcknowledge()`
    `void` | `setInputStream(InputStream input)`
    `void` | `setIntProperty(String name, int value)`
    `void` | `setJMSCorrelationID(String correlationID)`
    `void` | `setJMSCorrelationIDAsBytes(byte[] correlationID)`
    `void` | `setJMSDeliveryMode(int deliveryMode)`
    `void` | `setJMSDeliveryTime(long deliveryTime)`
    `void` | `setJMSDestination(javax.jms.Destination destination)`
    `void` | `setJMSExpiration(long expiration)`
    `void` | `setJMSMessageID(String jmsMessageID)`
    `void` | `setJMSPriority(int priority)`
    `void` | `setJMSRedelivered(boolean redelivered)`
    `void` | `setJMSReplyTo(javax.jms.Destination dest)`
    `void` | `setJMSTimestamp(long timestamp)`
    `void` | `setJMSType(String type)`
    `void` | `setLongProperty(String name, long value)`
    `void` | `setObjectProperty(String name, Object value)`
    `void` | `setOutputStream(OutputStream output)`
    `void` | `setShortProperty(String name, short value)`
    `void` | `setStringProperty(String name, String value)`
    `String` | `toString()`
    `boolean` | `waitCompletionOnStream(long timeWait)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### TYPE

          public static final byte TYPE

      See Also:
        Constant Field Values

    - #### message

          protected ClientMessage message

    - #### readOnly

          protected boolean readOnly

    - #### propertiesReadOnly

          protected boolean propertiesReadOnly

  - ### Constructor Detail

    - #### ActiveMQMessage

          protected ActiveMQMessage(byte type,
                                    ClientSession session)

    - #### ActiveMQMessage

          protected ActiveMQMessage(ClientSession session)

    - #### ActiveMQMessage

          public ActiveMQMessage(ClientMessage message,
                                 ClientSession session)

      Constructor for when receiving a message from the server

    - #### ActiveMQMessage

          public ActiveMQMessage(javax.jms.Message foreign,
                                 ClientSession session)
                          throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### ActiveMQMessage

          public ActiveMQMessage()

    - #### ActiveMQMessage

          protected ActiveMQMessage(javax.jms.Message foreign,
                                    byte type,
                                    ClientSession session)
                             throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

  - ### Method Detail

    - #### coreMaptoJMSMap

          public static Map<String,Object> coreMaptoJMSMap(Map<String,Object> coreMessage)

    - #### coreCompositeTypeToJMSCompositeType

          public static CompositeData coreCompositeTypeToJMSCompositeType(CompositeDataSupport data)
                                                                   throws Exception

      Throws:
        `Exception`

    - #### createMessage

          public static ActiveMQMessage createMessage(ClientMessage message,
                                                      ClientSession session)

    - #### createMessage

          public static ActiveMQMessage createMessage(ClientMessage message,
                                                      ClientSession session,
                                                      ConnectionFactoryOptions options)

    - #### getJMSMessageID

          public String getJMSMessageID()

      Specified by:
        `getJMSMessageID` in interface `javax.jms.Message`

    - #### setJMSMessageID

          public void setJMSMessageID(String jmsMessageID)
                               throws javax.jms.JMSException

      Specified by:
        `setJMSMessageID` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSTimestamp

          public long getJMSTimestamp()
                               throws javax.jms.JMSException

      Specified by:
        `getJMSTimestamp` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSTimestamp

          public void setJMSTimestamp(long timestamp)
                               throws javax.jms.JMSException

      Specified by:
        `setJMSTimestamp` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSCorrelationIDAsBytes

          public byte[] getJMSCorrelationIDAsBytes()
                                            throws javax.jms.JMSException

      Specified by:
        `getJMSCorrelationIDAsBytes` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSCorrelationIDAsBytes

          public void setJMSCorrelationIDAsBytes(byte[] correlationID)
                                          throws javax.jms.JMSException

      Specified by:
        `setJMSCorrelationIDAsBytes` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSCorrelationID

          public void setJMSCorrelationID(String correlationID)
                                   throws javax.jms.JMSException

      Specified by:
        `setJMSCorrelationID` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSCorrelationID

          public String getJMSCorrelationID()
                                     throws javax.jms.JMSException

      Specified by:
        `getJMSCorrelationID` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSReplyTo

          public javax.jms.Destination getJMSReplyTo()
                                              throws javax.jms.JMSException

      Specified by:
        `getJMSReplyTo` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSReplyTo

          public void setJMSReplyTo(javax.jms.Destination dest)
                             throws javax.jms.JMSException

      Specified by:
        `setJMSReplyTo` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSDestination

          public javax.jms.Destination getJMSDestination()
                                                  throws javax.jms.JMSException

      Specified by:
        `getJMSDestination` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSDestination

          public void setJMSDestination(javax.jms.Destination destination)
                                 throws javax.jms.JMSException

      Specified by:
        `setJMSDestination` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSDeliveryMode

          public int getJMSDeliveryMode()
                                 throws javax.jms.JMSException

      Specified by:
        `getJMSDeliveryMode` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSDeliveryMode

          public void setJMSDeliveryMode(int deliveryMode)
                                  throws javax.jms.JMSException

      Specified by:
        `setJMSDeliveryMode` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSRedelivered

          public boolean getJMSRedelivered()
                                    throws javax.jms.JMSException

      Specified by:
        `getJMSRedelivered` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSRedelivered

          public void setJMSRedelivered(boolean redelivered)
                                 throws javax.jms.JMSException

      Specified by:
        `setJMSRedelivered` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSType

          public void setJMSType(String type)
                          throws javax.jms.JMSException

      Specified by:
        `setJMSType` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSType

          public String getJMSType()
                            throws javax.jms.JMSException

      Specified by:
        `getJMSType` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSExpiration

          public long getJMSExpiration()
                                throws javax.jms.JMSException

      Specified by:
        `getJMSExpiration` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSExpiration

          public void setJMSExpiration(long expiration)
                                throws javax.jms.JMSException

      Specified by:
        `setJMSExpiration` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSPriority

          public int getJMSPriority()
                             throws javax.jms.JMSException

      Specified by:
        `getJMSPriority` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSPriority

          public void setJMSPriority(int priority)
                              throws javax.jms.JMSException

      Specified by:
        `setJMSPriority` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### clearProperties

          public void clearProperties()
                               throws javax.jms.JMSException

      Specified by:
        `clearProperties` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### clearBody

          public void clearBody()
                         throws javax.jms.JMSException

      Specified by:
        `clearBody` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### propertyExists

          public boolean propertyExists(String name)
                                 throws javax.jms.JMSException

      Specified by:
        `propertyExists` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getBooleanProperty

          public boolean getBooleanProperty(String name)
                                     throws javax.jms.JMSException

      Specified by:
        `getBooleanProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getByteProperty

          public byte getByteProperty(String name)
                               throws javax.jms.JMSException

      Specified by:
        `getByteProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getShortProperty

          public short getShortProperty(String name)
                                 throws javax.jms.JMSException

      Specified by:
        `getShortProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getIntProperty

          public int getIntProperty(String name)
                             throws javax.jms.JMSException

      Specified by:
        `getIntProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getLongProperty

          public long getLongProperty(String name)
                               throws javax.jms.JMSException

      Specified by:
        `getLongProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getFloatProperty

          public float getFloatProperty(String name)
                                 throws javax.jms.JMSException

      Specified by:
        `getFloatProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getDoubleProperty

          public double getDoubleProperty(String name)
                                   throws javax.jms.JMSException

      Specified by:
        `getDoubleProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getStringProperty

          public String getStringProperty(String name)
                                   throws javax.jms.JMSException

      Specified by:
        `getStringProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getObjectProperty

          public Object getObjectProperty(String name)
                                   throws javax.jms.JMSException

      Specified by:
        `getObjectProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getPropertyNames

          public Enumeration getPropertyNames()
                                       throws javax.jms.JMSException

      Specified by:
        `getPropertyNames` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setBooleanProperty

          public void setBooleanProperty(String name,
                                         boolean value)
                                  throws javax.jms.JMSException

      Specified by:
        `setBooleanProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setByteProperty

          public void setByteProperty(String name,
                                      byte value)
                               throws javax.jms.JMSException

      Specified by:
        `setByteProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setShortProperty

          public void setShortProperty(String name,
                                       short value)
                                throws javax.jms.JMSException

      Specified by:
        `setShortProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setIntProperty

          public void setIntProperty(String name,
                                     int value)
                              throws javax.jms.JMSException

      Specified by:
        `setIntProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setLongProperty

          public void setLongProperty(String name,
                                      long value)
                               throws javax.jms.JMSException

      Specified by:
        `setLongProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setFloatProperty

          public void setFloatProperty(String name,
                                       float value)
                                throws javax.jms.JMSException

      Specified by:
        `setFloatProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setDoubleProperty

          public void setDoubleProperty(String name,
                                        double value)
                                 throws javax.jms.JMSException

      Specified by:
        `setDoubleProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setStringProperty

          public void setStringProperty(String name,
                                        String value)
                                 throws javax.jms.JMSException

      Specified by:
        `setStringProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setObjectProperty

          public void setObjectProperty(String name,
                                        Object value)
                                 throws javax.jms.JMSException

      Specified by:
        `setObjectProperty` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### acknowledge

          public void acknowledge()
                           throws javax.jms.JMSException

      Specified by:
        `acknowledge` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getJMSDeliveryTime

          public long getJMSDeliveryTime()
                                  throws javax.jms.JMSException

      Specified by:
        `getJMSDeliveryTime` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### setJMSDeliveryTime

          public void setJMSDeliveryTime(long deliveryTime)
                                  throws javax.jms.JMSException

      Specified by:
        `setJMSDeliveryTime` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getBody

          public <T> T getBody(Class<T> c)
                        throws javax.jms.JMSException

      Specified by:
        `getBody` in interface `javax.jms.Message`
      Throws:
        `javax.jms.JMSException`

    - #### getBodyInternal

          protected <T> T getBodyInternal(Class<T> c)
                                   throws javax.jms.MessageFormatException

      Throws:
        `javax.jms.MessageFormatException`

    - #### isBodyAssignableTo

          public boolean isBodyAssignableTo(Class c)

      Specified by:
        `isBodyAssignableTo` in interface `javax.jms.Message`

    - #### hasNoBody

          protected boolean hasNoBody()

      Helper method for `isBodyAssignableTo(Class)`.
      Returns:
        true if the message has no body.

    - #### setIndividualAcknowledge

          public void setIndividualAcknowledge()

    - #### setClientAcknowledge

          public void setClientAcknowledge()

    - #### resetMessageID

          public void resetMessageID(String newMsgID)

    - #### getCoreMessage

          public ClientMessage getCoreMessage()

    - #### doBeforeSend

          public void doBeforeSend()
                            throws Exception

      Throws:
        `Exception`

    - #### checkBuffer

          public void checkBuffer()

    - #### doBeforeReceive

          public void doBeforeReceive()
                               throws ActiveMQException

      Throws:
        `ActiveMQException`

    - #### getType

          public byte getType()

    - #### setInputStream

          public void setInputStream(InputStream input)
                              throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### setOutputStream

          public void setOutputStream(OutputStream output)
                               throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### saveToOutputStream

          public void saveToOutputStream(OutputStream output)
                                  throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### waitCompletionOnStream

          public boolean waitCompletionOnStream(long timeWait)
                                         throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### checkWrite

          protected void checkWrite()
                             throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

    - #### checkRead

          protected void checkRead()
                            throws javax.jms.JMSException

      Throws:
        `javax.jms.JMSException`

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