TIBCO EMS .NET API 10.2
TIBCO EMS .NET API 10.2
TIBCO.EMS.MapMessage Class Reference

A MapMessage object is used to send a set of name-value pairs. The names are String objects, and the values are primitive data types in the .NET programming language. The names must have a value that is not null, and not an empty string. The entries can be accessed sequentially or randomly by name. The order of the entries is undefined. MapMessage inherits from the Message interface and adds a message body that contains a Map. More...

Inheritance diagram for TIBCO.EMS.MapMessage:
TIBCO.EMS.Message

Public Member Functions

 MapMessage (Session session)
 Construct an empty map message for a session. More...
 
override Object Clone ()
 Implements the clone method from ICloneable interfacae More...
 
bool GetBoolean (string name)
 Returns the boolean value with the specified name. More...
 
byte GetByte (string name)
 Returns the byte value with the specified name. More...
 
short GetShort (string name)
 Returns the short value with the specified name. More...
 
char GetChar (string name)
 Returns the char value with the specified name. More...
 
int GetInt (string name)
 Returns the int value with the specified name. More...
 
long GetLong (string name)
 Returns the long value with the specified name. More...
 
float GetFloat (string name)
 Returns the float value with the specified name. More...
 
double GetDouble (string name)
 Returns the double value with the specified name. More...
 
string GetString (string name)
 Returns the string value with the specified name. More...
 
byte[] GetBytes (string name)
 Returns the byte array value with the specified name. More...
 
Object GetObject (string name)
 Returns the object value with the specified name. More...
 
ICollection GetMapNames ()
 Returns a collection of all the names in the MapMessage object. More...
 
void SetBoolean (string name, bool value)
 Sets a boolean value with the specified name into the Map. More...
 
void SetByte (string name, byte value)
 Sets a byte value with the specified name into the Map. More...
 
void SetShort (string name, short value)
 Sets a short value with the specified name into the Map. More...
 
void SetChar (string name, char value)
 Sets a char value with the specified name into the Map. More...
 
void SetInt (string name, int value)
 Sets an int value with the specified name into the Map. More...
 
void SetLong (string name, long value)
 Sets a long value with the specified name into the Map. More...
 
void SetFloat (string name, float value)
 Sets a float value with the specified name into the Map. More...
 
void SetDouble (string name, double value)
 Sets a double value with the specified name into the Map. More...
 
void SetString (string name, String value)
 Sets a string value with the specified name into the Map. More...
 
void SetBytes (string name, byte[] value)
 Sets a byte array value with the specified name into the Map. More...
 
void SetBytes (string name, byte[] value, int offset, int length)
 Sets a portion of the byte array value with the specified name into the Map. More...
 
void SetObject (string name, Object value)
 Sets an object value with the specified name into the Map. More...
 
bool ItemExists (string name)
 Indicates whether an item exists in this MapMessage object. More...
 
override void ClearBody ()
 Clears out the message body. Clearing a message's body does not clear its header values or property entries. More...
 
override string ToString ()
 returns a string representation of the message More...
 
- Public Member Functions inherited from TIBCO.EMS.Message
virtual void ClearProperties ()
 Clears a message's properties. More...
 
virtual bool PropertyExists (string name)
 Test whether a named property has been set on a message. More...
 
bool GetBooleanProperty (string name)
 Returns the value of the boolean property with the specified name. More...
 
byte GetByteProperty (string name)
 Returns the value of the byte property with the specified name. More...
 
short GetShortProperty (string name)
 Returns the value of the short property with the specified name. More...
 
int GetIntProperty (string name)
 Returns the value of the int property with the specified name. More...
 
long GetLongProperty (string name)
 Returns the value of the long property with the specified name. More...
 
float GetFloatProperty (string name)
 Returns the value of the float property with the specified name. More...
 
double GetDoubleProperty (string name)
 Returns the value of the double property with the specified name. More...
 
string GetStringProperty (string name)
 Returns the value of the string property with the specified name. More...
 
Object GetObjectProperty (string name)
 Returns the value of the object property with the specified name. More...
 
virtual object GetProperty (string name, Type type)
 THIS IS FOR INTERNAL USE ONLY More...
 
void SetBooleanProperty (string name, bool val)
 Sets a boolean property value with the specified name into the message More...
 
void SetByteProperty (string name, byte val)
 Sets a byte property value with the specified name into the message More...
 
void SetShortProperty (string name, short val)
 Sets a short property value with the specified name into the message More...
 
void SetIntProperty (string name, int val)
 Sets a int property value with the specified name into the message More...
 
void SetLongProperty (string name, long val)
 Sets a long property value with the specified name into the message More...
 
void SetFloatProperty (string name, float val)
 Sets a float property value with the specified name into the message More...
 
void SetDoubleProperty (string name, double val)
 Sets a double property value with the specified name into the message More...
 
void SetStringProperty (string name, string val)
 Sets a string property value with the specified name into the message More...
 
void SetObjectProperty (string name, Object val)
 Sets an object property value with the specified name into the message More...
 
void SetBytesProperty (string name, byte[] val)
 FOR INTERNAL USE ONLY More...
 
virtual void Acknowledge ()
 Acknowledges all consumed messages of the session of this consumed message. More...
 
override string ToString ()
 returns a string representation of the message More...
 

Properties

int FieldCount [get]
 Returns number of fields that this message holds. More...
 
IEnumerator MapNames [get]
 Returns an Enumeration of all the names in the MapMessage object. More...
 
- Properties inherited from TIBCO.EMS.Message
bool IsCompressed [set]
 THIS IS FOR INTERNAL USE ONLY More...
 
string MessageID [get, set]
 Gets and Sets the message ID for the message. More...
 
long Timestamp [get, set]
 Gets and Sets the timestamp for the message. More...
 
string CorrelationID [get, set]
 Gets and Sets the correlation ID for the message. More...
 
byte[] CorrelationIDAsBytes [get, set]
 Gets and Sets the correlation ID as an array of bytes for the message. More...
 
Destination Destination [get, set]
 Gets and Sets the Destination object for this message. More...
 
Destination ReplyTo [get, set]
 Gets and Sets the message's replyto value. More...
 
int DeliveryMode [get, set]
 Get and set the message's delivery mode as an integer constant as defined in the DeliveryMode class. Users are recommended to use the MessageDeliveryMode enum instead. More...
 
MessageDeliveryMode MsgDeliveryMode [get, set]
 Get and set the message's delivery mode as enum value of type MessageDeliveryMode More...
 
bool Redelivered [get, set]
 Gets and Sets the message's redelivered value. More...
 
string MsgType [get, set]
 Gets and Sets the message's type value. More...
 
long Expiration [get, set]
 Gets and Sets the message's expiration value. More...
 
int Priority [get, set]
 Gets and Sets the message's priority value. More...
 
long DeliveryTime [get]
 Gets the message's delivery time value. More...
 
IEnumerator PropertyNames [get]
 Returns an Enumeration of all the property names. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from TIBCO.EMS.Message
static string GetDeliveryModeName (MessageDeliveryMode deliveryMode)
 
static string GetDeliveryModeName (int deliveryMode)
 
static string GetTimeName (long timestamp)
 
- Public Attributes inherited from TIBCO.EMS.Message
const int DEFAULT_DELIVERY_MODE = TIBCO.EMS.DeliveryMode.PERSISTENT
 The message producer's default delivery mode is PERSISTENT. More...
 
const MessageDeliveryMode DEFAULT_MSG_DELIVERY_MODE = TIBCO.EMS.MessageDeliveryMode.Persistent
 The message producer's default delivery mode is PERSISTENT. More...
 
const int DEFAULT_PRIORITY = 4
 The message producer's default priority is 4. More...
 
const long DEFAULT_TIME_TO_LIVE = 0
 The message producer's default time to live is unlimited; the message never expires. More...
 
- Static Public Attributes inherited from TIBCO.EMS.Message
static EmptyEnum emptyEnum = new EmptyEnum()
 empty enum object for internal use More...
 

Detailed Description

A MapMessage object is used to send a set of name-value pairs. The names are String objects, and the values are primitive data types in the .NET programming language. The names must have a value that is not null, and not an empty string. The entries can be accessed sequentially or randomly by name. The order of the entries is undefined. MapMessage inherits from the Message interface and adds a message body that contains a Map.

The primitive types can be read or written explicitly using methods for each type. They may also be read or written generically as objects. For instance, a call to MapMessage.setInt("foo", 6) is equivalent to MapMessage.setObject("foo", new Integer(6)). Both forms are provided, because the explicit form is convenient for static programming, and the object form is needed when types are not known at compile time.

When a client receives a MapMessage, it is in read-only mode. If a client attempts to write to the message at this point, a MessageNotWriteableException is thrown. If clearBody is called, the message can now be both read from and written to.

Extentions

TIBCO Enterprise Message Service extends the Jakarta Messaging MapMessage and StreamMessage body types in two ways. These extensions allow TIBCO Enterprise Message Service to exchange messages with TIBCO Rendezvous programs, which have certain features not available within the Jakarta Messaging specification.

  • You can insert another MapMessage or StreamMessage instance as a submessage into a MapMessage or StreamMessage, generating a series of nested messages, instead of a flat message.
  • You can use arrays as well as primitive types for the values.

These extensions add considerable flexibility to the two body types. However, they are extensions and therefore not compliant with Jakarta Messaging specifications. Extended messages are tagged as extensions with the vendor property tag JMS_TIBCO_MSG_EXT.

Constructor & Destructor Documentation

TIBCO.EMS.MapMessage.MapMessage ( Session  session)
inline

Construct an empty map message for a session.

Parameters
sessionThe session of the message.

Member Function Documentation

override void TIBCO.EMS.MapMessage.ClearBody ( )
inlinevirtual

Clears out the message body. Clearing a message's body does not clear its header values or property entries.

If this message body was read-only, calling this method leaves the message body in the same state as an empty body in a newly created message.

Reimplemented from TIBCO.EMS.Message.

override Object TIBCO.EMS.MapMessage.Clone ( )
inlinevirtual

Implements the clone method from ICloneable interfacae

Makes a clone of the message.

Reimplemented from TIBCO.EMS.Message.

bool TIBCO.EMS.MapMessage.GetBoolean ( string  name)
inline

Returns the boolean value with the specified name.

Parameters
namethe name of the boolean
Returns
The boolean value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
byte TIBCO.EMS.MapMessage.GetByte ( string  name)
inline

Returns the byte value with the specified name.

Parameters
namethe name of the byte
Returns
The byte value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
byte [] TIBCO.EMS.MapMessage.GetBytes ( string  name)
inline

Returns the byte array value with the specified name.

Parameters
namethe name of the byte array
Returns
The byte array value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
char TIBCO.EMS.MapMessage.GetChar ( string  name)
inline

Returns the char value with the specified name.

Parameters
namethe name of the char
Returns
The char value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
double TIBCO.EMS.MapMessage.GetDouble ( string  name)
inline

Returns the double value with the specified name.

Parameters
namethe name of the double
Returns
The double value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
float TIBCO.EMS.MapMessage.GetFloat ( string  name)
inline

Returns the float value with the specified name.

Parameters
namethe name of the float
Returns
The float value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
int TIBCO.EMS.MapMessage.GetInt ( string  name)
inline

Returns the int value with the specified name.

Parameters
namethe name of the int
Returns
The int value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
long TIBCO.EMS.MapMessage.GetLong ( string  name)
inline

Returns the long value with the specified name.

Parameters
namethe name of the long
Returns
The long value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
ICollection TIBCO.EMS.MapMessage.GetMapNames ( )
inline

Returns a collection of all the names in the MapMessage object.

Returns
A collection of all the names in this MapMessage

Programs can get a collection of the names of all the data items in the message body.

MapMessage mapMsg = sess.CreateMapMessage();
mapMsg.SetBoolean("bool1", true);
mapMsg.SetInt("int1", 42);
// if the user needs a collection for use in a foreach loop
ICollection mapNames = mapMsg.GetMapNames();
foreach (String name in mapNames)
Console.WriteLine("map name = " + name);
// if the user needs an enumerator like the old MapNames property
IEnumerator enumerator = mapMsg.GetMapNames().GetEnumerator();
while(enumerator.MoveNext())
{
String name = (String)enumerator.Current;
Console.WriteLine("map name = " + name);
}
Object TIBCO.EMS.MapMessage.GetObject ( string  name)
inline

Returns the object value with the specified name.

Parameters
namethe name of the object
Returns
The object value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
short TIBCO.EMS.MapMessage.GetShort ( string  name)
inline

Returns the short value with the specified name.

Parameters
namethe name of the short
Returns
The short value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
string TIBCO.EMS.MapMessage.GetString ( string  name)
inline

Returns the string value with the specified name.

Parameters
namethe name of the string
Returns
The string value with the specified name. Returns null if the message does not have a field set for the name.
Exceptions
EMSExceptionif the message could not be read due to an internal error
MessageFormatExceptionif this type conversion is invalid.
bool TIBCO.EMS.MapMessage.ItemExists ( string  name)
inline

Indicates whether an item exists in this MapMessage object.

Parameters
namethe name of the item to test
Returns
true if the item exists
void TIBCO.EMS.MapMessage.SetBoolean ( string  name,
bool  value 
)
inline

Sets a boolean value with the specified name into the Map.

Parameters
nameThe name of the boolean. Name cannot be null or an empty string.
valueThe boolean value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
void TIBCO.EMS.MapMessage.SetByte ( string  name,
byte  value 
)
inline

Sets a byte value with the specified name into the Map.

Parameters
nameThe name of the byte. Name cannot be null or an empty string.
valueThe byte value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
void TIBCO.EMS.MapMessage.SetBytes ( string  name,
byte[]  value 
)
inline

Sets a byte array value with the specified name into the Map.

Parameters
nameThe name of the byte array.
valueThe byte array value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
void TIBCO.EMS.MapMessage.SetBytes ( string  name,
byte[]  value,
int  offset,
int  length 
)
inline

Sets a portion of the byte array value with the specified name into the Map.

Parameters
nameThe name of the boolean.
valueThe byte array value to set in the Map
offsetthe initial offset within the byte array
lengththe number of bytes to use

This method extracts the specified bytes and uses them as the value; otherwise it uses the entire byte array. The offset and length arguments must be between zero and value.length (inclusive) and their sum must also fall within the same range. That is, these two arguments must specify a span of bytes within the value argument. Otherwise, this method throws an System.IndexOutOfRangeException and does not set any value.

Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if value is null
IndexOutOfRangeExceptionAn IndexOutOfRangeException may be thrown if the offset and length arguments do not specify a span of bytes within the array specified by the value argument.
void TIBCO.EMS.MapMessage.SetChar ( string  name,
char  value 
)
inline

Sets a char value with the specified name into the Map.

Parameters
nameThe name of the char. Name cannot be null or an empty string.
valueThe char value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
void TIBCO.EMS.MapMessage.SetDouble ( string  name,
double  value 
)
inline

Sets a double value with the specified name into the Map.

Parameters
nameThe name of the double. Name cannot be null or an empty string.
valueThe double value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
void TIBCO.EMS.MapMessage.SetFloat ( string  name,
float  value 
)
inline

Sets a float value with the specified name into the Map.

Parameters
nameThe name of the float. Name cannot be null or an empty string.
valueThe float value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
void TIBCO.EMS.MapMessage.SetInt ( string  name,
int  value 
)
inline

Sets an int value with the specified name into the Map.

Parameters
nameThe name of the int. Name cannot be null or an empty string.
valueThe int value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
void TIBCO.EMS.MapMessage.SetLong ( string  name,
long  value 
)
inline

Sets a long value with the specified name into the Map.

Parameters
nameThe name of the long. Name cannot be null or an empty string.
valueThe long value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
void TIBCO.EMS.MapMessage.SetObject ( string  name,
Object  value 
)
inline

Sets an object value with the specified name into the Map.

Parameters
nameThe name of the object. Name cannot be null or an empty string.
valueThe object value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
void TIBCO.EMS.MapMessage.SetShort ( string  name,
short  value 
)
inline

Sets a short value with the specified name into the Map.

Parameters
nameThe name of the short. Name cannot be null or an empty string.
valueThe short value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
void TIBCO.EMS.MapMessage.SetString ( string  name,
String  value 
)
inline

Sets a string value with the specified name into the Map.

Parameters
nameThe name of the string
valueThe string value to set in the Map
Exceptions
MessageNotWriteableExceptionA MessageNotWriteableException may be thrown if the message is in read-only mode
ArgumentExceptionAn ArgumentException may be thrown if the name is null or if the name is an empty string
override string TIBCO.EMS.MapMessage.ToString ( )
inline

returns a string representation of the message

Returns
a string representation of the message

Property Documentation

int TIBCO.EMS.MapMessage.FieldCount
get

Returns number of fields that this message holds.

Programs cannot set this property.

IEnumerator TIBCO.EMS.MapMessage.MapNames
get

Returns an Enumeration of all the names in the MapMessage object.

Programs can get an enumerator that produces the names of all the data items in the message body.

Returns
an enumeration of all the names in this MapMessage
Deprecated:
Use the GetMapNames() instead, which returns a collection of names

Copyright © Cloud Software Group, Inc. All rights reserved.