Class PulsarObjectMessage

java.lang.Object
com.datastax.oss.pulsar.jms.PulsarMessage
com.datastax.oss.pulsar.jms.messages.PulsarObjectMessage
All Implemented Interfaces:
javax.jms.Message, javax.jms.ObjectMessage

public final class PulsarObjectMessage extends PulsarMessage implements javax.jms.ObjectMessage
  • Constructor Details

    • PulsarObjectMessage

      public PulsarObjectMessage(Serializable object) throws javax.jms.JMSException
      Throws:
      javax.jms.JMSException
    • PulsarObjectMessage

      public PulsarObjectMessage(byte[] originalMessage) throws javax.jms.JMSException
      Throws:
      javax.jms.JMSException
    • PulsarObjectMessage

      public PulsarObjectMessage()
  • Method Details

    • messageType

      protected String messageType()
      Specified by:
      messageType in class PulsarMessage
    • isBodyAssignableTo

      public boolean isBodyAssignableTo(Class c) throws javax.jms.JMSException
      Specified by:
      isBodyAssignableTo 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
    • getBody

      public <T> T getBody(Class<T> c) throws javax.jms.JMSException
      Specified by:
      getBody in interface javax.jms.Message
      Throws:
      javax.jms.JMSException
    • prepareForSend

      protected void prepareForSend(org.apache.pulsar.client.api.TypedMessageBuilder<byte[]> producer) throws javax.jms.JMSException
      Specified by:
      prepareForSend in class PulsarMessage
      Throws:
      javax.jms.JMSException
    • setObject

      public void setObject(Serializable object) throws javax.jms.JMSException
      Sets the serializable object containing this message's data. It is important to note that an ObjectMessage contains a snapshot of the object at the time setObject() is called; subsequent modifications of the object will have no effect on the ObjectMessage body.
      Specified by:
      setObject in interface javax.jms.ObjectMessage
      Parameters:
      object - the message's data
      Throws:
      javax.jms.JMSException - if the JMS provider fails to set the object due to some internal error.
      javax.jms.MessageFormatException - if object serialization fails.
      javax.jms.MessageNotWriteableException - if the message is in read-only mode.
    • getObject

      public Serializable getObject() throws javax.jms.JMSException
      Gets the serializable object containing this message's data. The default value is null.
      Specified by:
      getObject in interface javax.jms.ObjectMessage
      Returns:
      the serializable object containing this message's data
      Throws:
      javax.jms.JMSException - if the JMS provider fails to get the object due to some internal error.
      javax.jms.MessageFormatException - if object deserialization fails.
    • toString

      public String toString()
      Overrides:
      toString in class Object