Class PulsarMapMessage
java.lang.Object
com.datastax.oss.pulsar.jms.PulsarMessage
com.datastax.oss.pulsar.jms.messages.PulsarMapMessage
- All Implemented Interfaces:
javax.jms.MapMessage,javax.jms.Message
-
Field Summary
Fields inherited from class com.datastax.oss.pulsar.jms.PulsarMessage
properties, writableFields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE -
Constructor Summary
ConstructorsConstructorDescriptionPulsarMapMessage(byte[] payload) PulsarMapMessage(Map<String, Object> body) PulsarMapMessage(Map<String, Object> body, boolean validate) -
Method Summary
Modifier and TypeMethodDescriptionvoid<T> TbooleangetBoolean(String name) Returns thebooleanvalue with the specified name.byteReturns thebytevalue with the specified name.byte[]Returns the byte array value with the specified name.charReturns the Unicode character value with the specified name.doubleReturns thedoublevalue with the specified name.floatReturns thefloatvalue with the specified name.intReturns theintvalue with the specified name.longReturns thelongvalue with the specified name.Returns anEnumerationof all the names in theMapMessageobject.Returns the value of the object with the specified name.shortReturns theshortvalue with the specified name.Returns theStringvalue with the specified name.booleanbooleanitemExists(String name) Indicates whether an item exists in thisMapMessageobject.protected Stringprotected voidprepareForSend(org.apache.pulsar.client.api.TypedMessageBuilder<byte[]> producer) voidsetBoolean(String name, boolean value) Sets abooleanvalue with the specified name into the Map.voidSets abytevalue with the specified name into the Map.voidSets a byte array value with the specified name into the Map.voidSets a portion of the byte array value with the specified name into the Map.voidSets a Unicode character value with the specified name into the Map.voidSets adoublevalue with the specified name into the Map.voidSets afloatvalue with the specified name into the Map.voidSets anintvalue with the specified name into the Map.voidSets alongvalue with the specified name into the Map.voidSets an object value with the specified name into the Map.voidSets ashortvalue with the specified name into the Map.voidSets aStringvalue with the specified name into the Map.Methods inherited from class com.datastax.oss.pulsar.jms.PulsarMessage
acknowledge, acknowledgeInternalInTransaction, applyMessage, checkReadable, checkWritable, checkWritableProperty, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getReceivedPulsarMessage, getShortProperty, getStringProperty, handleExceptionAccordingToMessageSpecs, isReceivedFromConsumer, negativeAck, propertyExists, readJMSPriority, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty, setWritable, validateWritableObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.jms.Message
acknowledge, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
-
Constructor Details
-
PulsarMapMessage
public PulsarMapMessage() -
PulsarMapMessage
- Throws:
javax.jms.MessageFormatException
-
PulsarMapMessage
public PulsarMapMessage(Map<String, Object> body, boolean validate) throws javax.jms.MessageFormatException- Throws:
javax.jms.MessageFormatException
-
PulsarMapMessage
public PulsarMapMessage(byte[] payload) throws javax.jms.JMSException - Throws:
javax.jms.JMSException
-
-
Method Details
-
messageType
- Specified by:
messageTypein classPulsarMessage
-
clearBody
public void clearBody() throws javax.jms.JMSException- Specified by:
clearBodyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getBody
- Specified by:
getBodyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
isBodyAssignableTo
- Specified by:
isBodyAssignableToin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
prepareForSend
protected void prepareForSend(org.apache.pulsar.client.api.TypedMessageBuilder<byte[]> producer) throws javax.jms.JMSException - Specified by:
prepareForSendin classPulsarMessage- Throws:
javax.jms.JMSException
-
getBoolean
Returns thebooleanvalue with the specified name.- Specified by:
getBooleanin interfacejavax.jms.MapMessage- Parameters:
name- the name of theboolean- Returns:
- the
booleanvalue with the specified name - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageFormatException- if this type conversion is invalid.
-
getByte
Returns thebytevalue with the specified name.- Specified by:
getBytein interfacejavax.jms.MapMessage- Parameters:
name- the name of thebyte- Returns:
- the
bytevalue with the specified name - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageFormatException- if this type conversion is invalid.
-
getShort
Returns theshortvalue with the specified name.- Specified by:
getShortin interfacejavax.jms.MapMessage- Parameters:
name- the name of theshort- Returns:
- the
shortvalue with the specified name - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageFormatException- if this type conversion is invalid.
-
getChar
Returns the Unicode character value with the specified name.- Specified by:
getCharin interfacejavax.jms.MapMessage- Parameters:
name- the name of the Unicode character- Returns:
- the Unicode character value with the specified name
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageFormatException- if this type conversion is invalid.
-
getInt
Returns theintvalue with the specified name.- Specified by:
getIntin interfacejavax.jms.MapMessage- Parameters:
name- the name of theint- Returns:
- the
intvalue with the specified name - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageFormatException- if this type conversion is invalid.
-
getLong
Returns thelongvalue with the specified name.- Specified by:
getLongin interfacejavax.jms.MapMessage- Parameters:
name- the name of thelong- Returns:
- the
longvalue with the specified name - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageFormatException- if this type conversion is invalid.
-
getFloat
Returns thefloatvalue with the specified name.- Specified by:
getFloatin interfacejavax.jms.MapMessage- Parameters:
name- the name of thefloat- Returns:
- the
floatvalue with the specified name - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageFormatException- if this type conversion is invalid.
-
getDouble
Returns thedoublevalue with the specified name.- Specified by:
getDoublein interfacejavax.jms.MapMessage- Parameters:
name- the name of thedouble- Returns:
- the
doublevalue with the specified name - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageFormatException- if this type conversion is invalid.
-
getString
Returns theStringvalue with the specified name.- Specified by:
getStringin interfacejavax.jms.MapMessage- Parameters:
name- the name of theString- Returns:
- the
Stringvalue with the specified name; if there is no item by this name, a null value is returned - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageFormatException- if this type conversion is invalid.
-
getBytes
Returns the byte array value with the specified name.- Specified by:
getBytesin interfacejavax.jms.MapMessage- Parameters:
name- the name of the byte array- Returns:
- a copy of the byte array value with the specified name; if there is no item by this name, a null value is returned.
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageFormatException- if this type conversion is invalid.
-
getObject
Returns the value of the object with the specified name.This method can be used to return, in objectified format, an object in the Java programming language ("Java object") that had been stored in the Map with the equivalent
setObjectmethod call, or its equivalent primitivesettypemethod.Note that byte values are returned as
byte[], notByte[].- Specified by:
getObjectin interfacejavax.jms.MapMessage- Parameters:
name- the name of the Java object- Returns:
- a copy of the Java object value with the specified name, in objectified format (for
example, if the object was set as an
int, anIntegeris returned); if there is no item by this name, a null value is returned - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.
-
getMapNames
Returns anEnumerationof all the names in theMapMessageobject.- Specified by:
getMapNamesin interfacejavax.jms.MapMessage- Returns:
- an enumeration of all the names in this
MapMessage - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.
-
setBoolean
Sets abooleanvalue with the specified name into the Map.- Specified by:
setBooleanin interfacejavax.jms.MapMessage- Parameters:
name- the name of thebooleanvalue- thebooleanvalue to set in the Map- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setByte
Sets abytevalue with the specified name into the Map.- Specified by:
setBytein interfacejavax.jms.MapMessage- Parameters:
name- the name of thebytevalue- thebytevalue to set in the Map- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setShort
Sets ashortvalue with the specified name into the Map.- Specified by:
setShortin interfacejavax.jms.MapMessage- Parameters:
name- the name of theshortvalue- theshortvalue to set in the Map- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setChar
Sets a Unicode character value with the specified name into the Map.- Specified by:
setCharin interfacejavax.jms.MapMessage- Parameters:
name- the name of the Unicode charactervalue- the Unicode character value to set in the Map- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setInt
Sets anintvalue with the specified name into the Map.- Specified by:
setIntin interfacejavax.jms.MapMessage- Parameters:
name- the name of theintvalue- theintvalue to set in the Map- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setLong
Sets alongvalue with the specified name into the Map.- Specified by:
setLongin interfacejavax.jms.MapMessage- Parameters:
name- the name of thelongvalue- thelongvalue to set in the Map- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setFloat
Sets afloatvalue with the specified name into the Map.- Specified by:
setFloatin interfacejavax.jms.MapMessage- Parameters:
name- the name of thefloatvalue- thefloatvalue to set in the Map- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setDouble
Sets adoublevalue with the specified name into the Map.- Specified by:
setDoublein interfacejavax.jms.MapMessage- Parameters:
name- the name of thedoublevalue- thedoublevalue to set in the Map- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setString
Sets aStringvalue with the specified name into the Map.- Specified by:
setStringin interfacejavax.jms.MapMessage- Parameters:
name- the name of theStringvalue- theStringvalue to set in the Map- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setBytes
Sets a byte array value with the specified name into the Map.- Specified by:
setBytesin interfacejavax.jms.MapMessage- Parameters:
name- the name of the byte arrayvalue- the byte array value to set in the Map; the array is copied so that the value fornamewill not be altered by future modifications- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null, or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setBytes
public void setBytes(String name, byte[] value, int offset, int length) throws javax.jms.JMSException Sets a portion of the byte array value with the specified name into the Map.- Specified by:
setBytesin interfacejavax.jms.MapMessage- Parameters:
name- the name of the byte arrayvalue- the byte array value to set in the Mapoffset- the initial offset within the byte arraylength- the number of bytes to use- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
setObject
Sets an object value with the specified name into the Map.This method works only for the objectified primitive object types (
Integer,Double,Long...),Stringobjects, and byte arrays.- Specified by:
setObjectin interfacejavax.jms.MapMessage- Parameters:
name- the name of the Java objectvalue- the Java object value to set in the Map- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.IllegalArgumentException- if the name is null or if the name is an empty string.javax.jms.MessageFormatException- if the object is invalid.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
itemExists
Indicates whether an item exists in thisMapMessageobject.- Specified by:
itemExistsin interfacejavax.jms.MapMessage- Parameters:
name- the name of the item to test- Returns:
- true if the item exists
- Throws:
javax.jms.JMSException- if the JMS provider fails to determine if the item exists due to some internal error.
-