|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.j_spaces.jms.GSMessageImpl
public class GSMessageImpl
GigaSpaces platform implementation of the javax.jms.Message
interface.
Field Summary | |
---|---|
static int |
BODY_NUM
|
static String |
BODY_STR_NAME
|
static String |
BOOLEAN_CLASS_NAME
|
static String |
BYTES
A bytes message carries an array of bytes. |
static String |
CONTROL_MESSAGE
A control message that is used for Keeping the Destination alive. |
static String |
DESTINATION_CLASS_NAME
|
static String |
HASHMAP_CLASS_NAME
|
static String |
INTEGER_CLASS_NAME
|
static String |
JMS_CORRELATION_ID
|
static int |
JMS_CORRELATION_ID_NUM
|
static String |
JMS_DELIVERY_MODE
|
static int |
JMS_DELIVERY_MODE_NUM
|
static String |
JMS_DESTINATION
|
static int |
JMS_DESTINATION_NUM
|
static String |
JMS_EXPIRATION
|
static int |
JMS_EXPIRATION_NUM
|
static String |
JMS_GSPRODUCER_KEY_PROP_NAME
The producer key that is set in the send method and is kept in the optional message properties and used in the consumer receive or onMessage, while ack for instance. |
static int |
JMS_GSPRODUCER_KEY_PROP_NUM
|
static String |
JMS_GSTTL_KEY_PROP_NAME
The TimeToLive of the JMSMessage which is the lease used to write() the ExternalEntry. |
static int |
JMS_GSTTL_PROP_NUM
|
static String |
JMS_MESSAGE_ID
|
static int |
JMS_MESSAGE_ID_NUM
|
static String |
JMS_PRIORITY
|
static int |
JMS_PRIORITY_NUM
|
static String |
JMS_REDELIVERED
|
static int |
JMS_REDELIVERED_NUM
|
static String |
JMS_REPLY_TO
|
static int |
JMS_REPLY_TO_NUM
|
static String |
JMS_TIMESTAMP
|
static int |
JMS_TIMESTAMP_NUM
|
static String |
JMS_TYPE
|
static int |
JMS_TYPE_NUM
|
static String |
JMSX_APPID
|
static String |
JMSX_GROUPID
|
static int |
JMSX_GROUPID_PROP_NUM
|
static String |
JMSX_GROUPSEQ
|
static int |
JMSX_GROUPSEQ_PROP_NUM
|
static String |
JMSX_RCV_TIMESTEMP
|
static String |
JMSX_USERID
|
static int |
JMSX_USERID_PROP_NUM
|
static String |
LONG_CLASS_NAME
|
boolean |
m_deletedDest
true if the message target destination was deleted. |
boolean |
m_denied
true if the message has been denied at least once by a
consumer. |
boolean |
m_expired
true if the message has expired. |
static String[] |
m_ExtEntryFieldsNames
Holds the field names array for the usage as params in the ExternalEntry. - The Message Body is the first, - Then all the Message Headers, - Then come all the JMS Properties, - Then the JMS_GS application specific properties, as detailed in GSConnectionMetaDataImpl. - The Message Properties which were set by the client currently these props cannot be used via the selector |
static String[] |
m_ExtEntryFieldsTypes
Holds the field m_type names array for the usage as params in the ExternalEntry. |
boolean |
m_notWriteable
true if the message could not be written on the dest. |
String |
m_replyToId
The reply to destination identifier. the name of the destination that the message got from. |
int |
m_totalNumOfValues
|
boolean |
m_undeliverable
true if the message is considered as undeliverable. |
static String |
MAP
A map message carries an hashtable. |
static String |
OBJECT
An object message carries a serializable object. |
static String |
OBJECT_CLASS_NAME
|
static int |
PROPERTIES_NUM
|
static String |
PROPERTIES_STR_NAME
|
static int |
reservedNumOfValues
|
static String |
SIMPLE
A simple message carries a simple empty body. |
static String |
STREAM
A stream message carries a bytes stream. |
static String |
STRING_CLASS_NAME
|
static String |
TEXT
A text message carries a String body. |
Fields inherited from interface javax.jms.Message |
---|
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE |
Constructor Summary | |
---|---|
GSMessageImpl(GSSessionImpl session,
String msgType)
Constructor: Constructs also an empty ExternalEntry that is embeded inside the JMSMessage and will hold all the JMSMessage elements- Body, Header and Properties and then sent/received via space. |
Method Summary | |
---|---|
void |
acknowledge()
Note that the acknowledge method of Message acknowledges all messages received on that messages session. |
void |
buildBodyFromBytes()
Builds the message body from data |
void |
clearBody()
Clear out the message body. |
void |
clearProperties()
Empties the properties table. |
int |
compareTo(Object o)
|
void |
convertBodyToBytes()
Convert the message body to data |
com.j_spaces.jms.utils.ByteArray |
getBodyAsBytes()
Returns the array of bytes body of the message. |
boolean |
getBooleanProperty(String name)
Returns a property as a boolean value. |
byte |
getByteProperty(String name)
Returns a property as a byte value. |
double |
getDoubleProperty(String name)
Returns a property as a double. |
float |
getFloatProperty(String name)
Returns a property as a float value. |
int |
getIntProperty(String name)
Returns a property as an int. |
String |
getJMSCorrelationID()
Sets the correlation ID for the message. |
byte[] |
getJMSCorrelationIDAsBytes()
|
int |
getJMSDeliveryMode()
Gets the DeliveryMode value specified for this message. |
Destination |
getJMSDestination()
Gets the message destination. |
long |
getJMSExpiration()
|
String |
getJMSMessageID()
|
int |
getJMSPriority()
|
boolean |
getJMSRedelivered()
|
Destination |
getJMSReplyTo()
|
long |
getJMSTimestamp()
|
String |
getJMSType()
API method. |
long |
getLongProperty(String name)
Returns a property as a long. |
HashMap |
getMapBody()
Returns the hashmap based body of the message. |
Object |
getObjectProperty(String name)
API method. |
Object |
getObjProp(String name)
|
Object |
getOptionalHeader(String name)
Returns an optional Message Header field value according to its name. |
HashMap |
getProperties()
|
Enumeration |
getPropertyNames()
Returns an enumeration of the properties names. |
short |
getShortProperty(String name)
Returns a property as a short. |
com.j_spaces.jms.utils.ByteArray |
getStreamBody()
Returns the stream of bytes body of the message. |
String |
getStringProperty(String name)
Returns a property as a String. |
String |
getTextBody()
Gets the String body of the message. |
Destination |
getToDestination()
|
boolean |
isBodyRO()
|
boolean |
isValid()
Returns true if the message is valid and
is not expired. |
boolean |
propertyExists(String name)
Returns true if a given property exists. |
void |
readBody(DataInput dataIn)
Used to help build the body from an input stream |
void |
setBodyAsBytes(byte[] data,
int offset,
int length)
|
void |
setBodyAsBytes(com.j_spaces.jms.utils.ByteArray bytes)
Sets the message body as an array of bytes. |
void |
setBooleanProperty(String name,
boolean value)
Sets a property as a boolean value. |
void |
setByteProperty(String name,
byte value)
Sets a property as a byte value. |
void |
setDoubleProperty(String name,
double value)
Sets a property as a double value. |
void |
setFloatProperty(String name,
float value)
Sets a property as a float value. |
void |
setIntProperty(String name,
int value)
Sets a property as a int value. |
void |
setJMSCorrelationID(String correlationID)
a null value for the JMSCorrelationID can be assigned to JMSCorrelationID when: - a message is initially constructed - a message is received with a non-null JMSCorrelationID |
void |
setJMSCorrelationIDAsBytes(byte[] correlationID)
|
void |
setJMSDeliveryMode(int deliveryMode)
The default Delivery Mode is DeliveryMode.PERSISTENT |
void |
setJMSDestination(Destination destination)
Sets the message destination. |
void |
setJMSExpiration(long expiration)
long expiration - the time to live |
void |
setJMSMessageID(String id)
update the jms message id, if there is none, then generate it. |
void |
setJMSPriority(int priority)
|
void |
setJMSRedelivered(boolean redelivered)
API method. |
void |
setJMSReplyTo(Destination replyTo)
|
void |
setJMSTimestamp(long timestamp)
|
void |
setJMSType(String type)
API method. |
void |
setLongProperty(String name,
long value)
Sets a property as a long value. |
void |
setMapBody(HashMap<String,Object> map)
Sets a map as the body of the message. |
void |
setObjectProperty(String name,
Object value)
Sets a property value. |
void |
setOptionalHeader(String name,
Object value)
Sets an optional header field value. |
void |
setShortProperty(String name,
short value)
Sets a property as a short value. |
void |
setStreamBody(com.j_spaces.jms.utils.ByteArray bytes)
Sets the message body as a stream of bytes. |
void |
setStringProperty(String name,
String value)
Sets a property as a String. |
void |
setTextBody(String text)
Sets a String as the body of the message. |
void |
setToDestination(Destination toDest)
|
String |
toString()
|
void |
writeBody(DataOutput dataOut)
Used serialize the message body to an output stream |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String HASHMAP_CLASS_NAME
public static final String STRING_CLASS_NAME
public static final String INTEGER_CLASS_NAME
public static final String LONG_CLASS_NAME
public static final String DESTINATION_CLASS_NAME
public static final String BOOLEAN_CLASS_NAME
public static final String OBJECT_CLASS_NAME
public static final String BODY_STR_NAME
public static final String PROPERTIES_STR_NAME
public static final int reservedNumOfValues
public int m_totalNumOfValues
public static final String[] m_ExtEntryFieldsNames
GSConnectionMetaDataImpl.getJMSXPropertyNames()
public static final String[] m_ExtEntryFieldsTypes
GSConnectionMetaDataImpl.getJMSXPropertyNames()
public static final String CONTROL_MESSAGE
public static final String SIMPLE
public static final String TEXT
public static final String OBJECT
public static final String MAP
public static final String STREAM
public static final String BYTES
public static final String JMS_DELIVERY_MODE
public static final String JMS_DESTINATION
public static final String JMS_PRIORITY
public static final String JMS_MESSAGE_ID
public static final String JMS_TIMESTAMP
public static final String JMS_TYPE
public static final String JMS_CORRELATION_ID
public static final String JMS_EXPIRATION
public static final String JMS_REPLY_TO
public static final String JMS_REDELIVERED
public static final String JMS_GSPRODUCER_KEY_PROP_NAME
public static final String JMS_GSTTL_KEY_PROP_NAME
public static final String JMSX_GROUPID
public static final String JMSX_GROUPSEQ
public static final String JMSX_USERID
public static final String JMSX_APPID
public static final String JMSX_RCV_TIMESTEMP
public static final int BODY_NUM
public static final int JMS_DESTINATION_NUM
public static final int JMS_DELIVERY_MODE_NUM
public static final int JMS_EXPIRATION_NUM
public static final int JMS_PRIORITY_NUM
public static final int JMS_MESSAGE_ID_NUM
public static final int JMS_TIMESTAMP_NUM
public static final int JMS_CORRELATION_ID_NUM
public static final int JMS_REPLY_TO_NUM
public static final int JMS_TYPE_NUM
public static final int JMS_REDELIVERED_NUM
public static final int JMS_GSPRODUCER_KEY_PROP_NUM
public static final int JMS_GSTTL_PROP_NUM
public static final int JMSX_GROUPID_PROP_NUM
public static final int JMSX_GROUPSEQ_PROP_NUM
public static final int JMSX_USERID_PROP_NUM
public static final int PROPERTIES_NUM
public String m_replyToId
public volatile boolean m_deletedDest
true
if the message target destination was deleted.
public volatile boolean m_expired
true
if the message has expired.
public volatile boolean m_notWriteable
true
if the message could not be written on the dest.
public volatile boolean m_undeliverable
true
if the message is considered as undeliverable.
public volatile boolean m_denied
true
if the message has been denied at least once by a
consumer.
Constructor Detail |
---|
public GSMessageImpl(GSSessionImpl session, String msgType) throws JMSException
session
- The consuming session.
JMSException
Method Detail |
---|
public String getJMSMessageID() throws JMSException
getJMSMessageID
in interface Message
JMSException
Message.getJMSMessageID()
public void setJMSMessageID(String id) throws JMSException
setJMSMessageID
in interface Message
id
-
JMSException
public long getJMSTimestamp() throws JMSException
getJMSTimestamp
in interface Message
JMSException
Message.getJMSTimestamp()
public void setJMSTimestamp(long timestamp) throws JMSException
setJMSTimestamp
in interface Message
timestamp
-
JMSException
Message.setJMSTimestamp(long)
public byte[] getJMSCorrelationIDAsBytes() throws JMSException
getJMSCorrelationIDAsBytes
in interface Message
JMSException
- if JMSCorrelationID is a stringMessage.getJMSCorrelationIDAsBytes()
public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws JMSException
setJMSCorrelationIDAsBytes
in interface Message
JMSException
Message.setJMSCorrelationIDAsBytes(byte[])
public void setJMSCorrelationID(String correlationID) throws JMSException
setJMSCorrelationID
in interface Message
JMSException
Message.setJMSCorrelationID(java.lang.String)
public String getJMSCorrelationID() throws JMSException
A client can use the JMSCorrelationID
header field to
link one message with another. A typical use is to link a response
message with its request message.
JMSCorrelationID
can hold one of the following:
String
byte[]
value
Since each message sent by a JMS provider is assigned a message ID
value, it is convenient to link messages via message ID. All message ID
values must start with the 'ID:'
prefix.
In some cases, an application (made up of several clients) needs to
use an application-specific value for linking messages. For instance,
an application may use JMSCorrelationID
to hold a value
referencing some external information. Application-specified values
must not start with the 'ID:'
prefix; this is reserved for
provider-generated message ID values.
If a provider supports the native concept of correlation ID, a JMS
client may need to assign specific JMSCorrelationID
values
to match those expected by clients that do not use the JMS API. A
byte[]
value is used for this
purpose. JMS providers without native correlation ID values are not
required to support byte[]
values. The use of a
byte[]
value for JMSCorrelationID
is
non-portable.
getJMSCorrelationID
in interface Message
JMSException
- if the JMS provider fails to set the correlation
ID due to some internal error.
JMSException
- if JMSCorrelationID is is an arrayMessage.getJMSCorrelationID()
,
Message.getJMSCorrelationIDAsBytes()
,
Message.setJMSCorrelationIDAsBytes(byte[])
public Destination getJMSReplyTo() throws JMSException
getJMSReplyTo
in interface Message
JMSException
Message.getJMSReplyTo()
public void setJMSReplyTo(Destination replyTo) throws JMSException
setJMSReplyTo
in interface Message
JMSException
Message.setJMSReplyTo(javax.jms.Destination)
public Destination getJMSDestination() throws JMSException
getJMSDestination
in interface Message
JMSException
Message.getJMSDestination()
public void setJMSDestination(Destination destination) throws JMSException
setJMSDestination
in interface Message
JMSException
Message.setJMSDestination(javax.jms.Destination)
public int getJMSDeliveryMode() throws JMSException
DeliveryMode
value specified for this message.
Having the values 'PERSISTENT'
and
'NON_PERSISTENT'
.
getJMSDeliveryMode
in interface Message
JMSException
Message.getJMSDeliveryMode()
public void setJMSDeliveryMode(int deliveryMode) throws JMSException
setJMSDeliveryMode
in interface Message
JMSException
Message.setJMSDeliveryMode(int)
public boolean getJMSRedelivered() throws JMSException
getJMSRedelivered
in interface Message
JMSException
Message.getJMSRedelivered()
public void setJMSRedelivered(boolean redelivered) throws JMSException
setJMSRedelivered
in interface Message
JMSException
Message.setJMSRedelivered(boolean)
public String getJMSType() throws JMSException
getJMSType
in interface Message
JMSException
- Actually never thrown.public void setJMSType(String type) throws JMSException
setJMSType
in interface Message
JMSException
- Actually never thrown.public long getJMSExpiration() throws JMSException
getJMSExpiration
in interface Message
JMSException
Message.getJMSExpiration()
public void setJMSExpiration(long expiration) throws JMSException
setJMSExpiration
in interface Message
JMSException
public int getJMSPriority() throws JMSException
getJMSPriority
in interface Message
JMSException
Message.getJMSPriority()
public void setJMSPriority(int priority) throws JMSException
setJMSPriority
in interface Message
JMSException
Message.setJMSPriority(int)
public boolean getBooleanProperty(String name) throws JMSException
getBooleanProperty
in interface Message
name
- The property name.
JMSException
Message.getBooleanProperty(java.lang.String)
public byte getByteProperty(String name) throws JMSException
getByteProperty
in interface Message
name
- The property name.
JMSException
Message.getByteProperty(java.lang.String)
public short getShortProperty(String name) throws JMSException
getShortProperty
in interface Message
JMSException
Message.getShortProperty(java.lang.String)
public int getIntProperty(String name) throws JMSException
getIntProperty
in interface Message
JMSException
Message.getIntProperty(java.lang.String)
public long getLongProperty(String name) throws JMSException
getLongProperty
in interface Message
JMSException
Message.getLongProperty(java.lang.String)
public float getFloatProperty(String name) throws JMSException
getFloatProperty
in interface Message
name
- The property name.
JMSException
Message.getFloatProperty(java.lang.String)
public double getDoubleProperty(String name) throws JMSException
getDoubleProperty
in interface Message
name
- The property name.
JMSException
public String getStringProperty(String name) throws JMSException
getStringProperty
in interface Message
name
- The property name.
JMSException
public Object getObjectProperty(String name) throws JMSException
getObjectProperty
in interface Message
JMSException
- If the name is invalid.public Object getObjProp(String name)
JMSException
- If the name is invalid.public void setBooleanProperty(String name, boolean value) throws JMSException
setBooleanProperty
in interface Message
name
- The property name.value
- The property value.
JMSException
Message.setBooleanProperty(java.lang.String, boolean)
public void setByteProperty(String name, byte value) throws JMSException
setByteProperty
in interface Message
name
- The property name.value
- The property value.
JMSException
Message.setByteProperty(java.lang.String, byte)
public void setShortProperty(String name, short value) throws JMSException
setShortProperty
in interface Message
name
- The property name.value
- The property value.
JMSException
Message.setShortProperty(java.lang.String, short)
public void setIntProperty(String name, int value) throws JMSException
setIntProperty
in interface Message
name
- The property name.value
- The property value.
JMSException
Message.setIntProperty(java.lang.String, int)
public void setLongProperty(String name, long value) throws JMSException
setLongProperty
in interface Message
name
- The property name.value
- The property value.
JMSException
Message.setLongProperty(java.lang.String, long)
public void setFloatProperty(String name, float value) throws JMSException
setFloatProperty
in interface Message
name
- The property name.value
- The property value.
JMSException
Message.setFloatProperty(java.lang.String, float)
public void setDoubleProperty(String name, double value) throws JMSException
setDoubleProperty
in interface Message
name
- The property name.value
- The property value.
JMSException
Message.setDoubleProperty(java.lang.String, double)
public void setStringProperty(String name, String value) throws JMSException
setStringProperty
in interface Message
name
- The property name.value
- The property value.
JMSException
public void setObjectProperty(String name, Object value) throws JMSException
setObjectProperty
in interface Message
name
- The property name.value
- The property value.
MessageNotWriteableException
- If the message properties are read-only.
MessageValueException
- If the value is not a Java primitive
object.
JMSException
public Object getOptionalHeader(String name)
name
- The header field name.public void acknowledge() throws JMSException
acknowledge
in interface Message
JMSException
Message.acknowledge()
public void clearBody() throws JMSException
clearBody
in interface Message
JMSException
Message.clearBody()
public boolean isValid()
true
if the message is valid and
is not expired.
public boolean propertyExists(String name)
true
if a given property exists.
propertyExists
in interface Message
name
- The name of the property to check.public Enumeration getPropertyNames()
getPropertyNames
in interface Message
public void clearProperties()
clearProperties
in interface Message
public void setOptionalHeader(String name, Object value)
name
- The header field name.value
- The corresponding value.public final void convertBodyToBytes() throws IOException
IOException
public final void buildBodyFromBytes() throws IOException
IOException
public void setMapBody(HashMap<String,Object> map) throws MessageNotWriteableException
map
-
IOException
- In case of an error while setting the map.
MessageNotWriteableException
- If the message body is read-only.public void setTextBody(String text) throws MessageNotWriteableException
text
-
MessageNotWriteableException
- If the message body is read-only.public void setStreamBody(com.j_spaces.jms.utils.ByteArray bytes) throws MessageNotWriteableException
bytes
-
MessageNotWriteableException
- If the message body is read-only.public void setBodyAsBytes(com.j_spaces.jms.utils.ByteArray bytes) throws MessageNotWriteableException
bytes
-
MessageNotWriteableException
- If the message body is read-only.public void setBodyAsBytes(byte[] data, int offset, int length)
data
- The bodyAsBytes to set.offset
- length
- public HashMap getMapBody()
public String getTextBody()
public com.j_spaces.jms.utils.ByteArray getStreamBody()
public com.j_spaces.jms.utils.ByteArray getBodyAsBytes() throws IOException
IOException
public HashMap getProperties()
public String toString()
toString
in class Object
public boolean isBodyRO()
public int compareTo(Object o)
compareTo
in interface Comparable
public Destination getToDestination()
public void setToDestination(Destination toDest)
toDest
- The destination to set.public void writeBody(DataOutput dataOut) throws IOException
dataOut
-
IOException
public void readBody(DataInput dataIn) throws IOException
dataIn
-
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |