Class AmqpJmsBytesMessageFacade

java.lang.Object
org.apache.qpid.jms.provider.amqp.message.AmqpJmsMessageFacade
org.apache.qpid.jms.provider.amqp.message.AmqpJmsBytesMessageFacade
All Implemented Interfaces:
JmsBytesMessageFacade, JmsMessageFacade, TraceableMessage

public class AmqpJmsBytesMessageFacade extends AmqpJmsMessageFacade implements JmsBytesMessageFacade
A JmsBytesMessageFacade that wraps around Proton AMQP Message instances to provide access to the underlying bytes contained in the message.
  • Constructor Details

    • AmqpJmsBytesMessageFacade

      public AmqpJmsBytesMessageFacade()
  • Method Details

    • initializeEmptyBody

      protected void initializeEmptyBody()
      Description copied from class: AmqpJmsMessageFacade
      Used to indicate that a Message object should empty the body element and make any other internal updates to reflect the message now has no body value.
      Overrides:
      initializeEmptyBody in class AmqpJmsMessageFacade
    • copy

      Description copied from interface: JmsMessageFacade
      Create a new instance and perform a deep copy of this object's contents.
      Specified by:
      copy in interface JmsBytesMessageFacade
      Specified by:
      copy in interface JmsMessageFacade
      Overrides:
      copy in class AmqpJmsMessageFacade
      Returns:
      a copy of this JmsMessageFacade instance.
    • getJmsMsgType

      public byte getJmsMsgType()
      Overrides:
      getJmsMsgType in class AmqpJmsMessageFacade
      Returns:
      the appropriate byte value that indicates the type of message this is.
    • clearBody

      public void clearBody()
      Description copied from interface: JmsMessageFacade
      Clears the contents of this Message.
      Specified by:
      clearBody in interface JmsMessageFacade
      Overrides:
      clearBody in class AmqpJmsMessageFacade
    • getInputStream

      public InputStream getInputStream() throws jakarta.jms.JMSException
      Description copied from interface: JmsBytesMessageFacade
      Create and return an InputStream instance that can be used to read the contents of this message. If an OutputStream was previously created and no call to reset has yet been made then this method will throw an exception. Multiple calls to this method should return the same InputStream instance, only when the message has been reset should the current input stream instance be discarded and a new one created on demand. While this means the multiple concurrent readers is possible it is strongly discouraged. If the message body contains data that has been compressed and can be determined to be so by the implementation then this method will return an InputStream instance that can inflate the compressed data.
      Specified by:
      getInputStream in interface JmsBytesMessageFacade
      Returns:
      an InputStream instance to read the message body.
      Throws:
      jakarta.jms.JMSException - if an error occurs creating the stream.
      jakarta.jms.IllegalStateException - if there is a current OutputStream in use.
    • getOutputStream

      public OutputStream getOutputStream() throws jakarta.jms.JMSException
      Description copied from interface: JmsBytesMessageFacade
      Create and return a new OuputStream used to populate the body of the message. If an InputStream was previously requested this method will fail until such time as a call to reset has been requested. If an existing OuputStream has already been created then this method will return that stream until such time as the reset method has been called.
      Specified by:
      getOutputStream in interface JmsBytesMessageFacade
      Returns:
      an OutputStream instance to write the message body.
      Throws:
      jakarta.jms.JMSException - if an error occurs creating the stream.
      jakarta.jms.IllegalStateException - if there is a current OutputStream in use.
    • reset

      public void reset()
      Description copied from interface: JmsBytesMessageFacade
      Reset the message state such that a call to getInputStream or getOutputStream will succeed. If an OutputStream instance exists it is closed an the current contents are stored into the message body.
      Specified by:
      reset in interface JmsBytesMessageFacade
    • getBodyLength

      public int getBodyLength()
      Specified by:
      getBodyLength in interface JmsBytesMessageFacade
      Returns:
      the number of bytes contained in the body of the message.
    • hasBody

      public boolean hasBody()
      Description copied from interface: JmsMessageFacade
      Returns true if the underlying message has a body, false if the body is empty.
      Specified by:
      hasBody in interface JmsMessageFacade
      Overrides:
      hasBody in class AmqpJmsMessageFacade
      Returns:
      true if the underlying message has a body, false if the body is empty.
    • asJmsMessage

      public JmsBytesMessage asJmsMessage()
      Overrides:
      asJmsMessage in class AmqpJmsMessageFacade
    • copyBody

      public byte[] copyBody()
      Specified by:
      copyBody in interface JmsBytesMessageFacade
      Returns:
      a copy of the bytes contained in the body of the message.
    • onSend

      public void onSend(long producerTtl) throws jakarta.jms.JMSException
      Description copied from interface: JmsMessageFacade
      Called before a message is sent to allow a Message instance to move the contents from a logical data structure to a binary form for transmission, or other processing such as setting proper message headers etc. The method allows for passing through producer configuration details not explicitly mapped into the JMS Message allowing the facade to create the most correct and compact message on the wire.
      Specified by:
      onSend in interface JmsMessageFacade
      Overrides:
      onSend in class AmqpJmsMessageFacade
      Parameters:
      producerTtl - the time to live value configured on the producer when sent.
      Throws:
      jakarta.jms.JMSException - if an error occurs while preparing the message for send.