Message Class
A message is the unit that is enqueued dequeued. A Message object holds both its content, or payload, and its properties. This class provides methods to get and set message properties.
Table 13-25 Enumerated Values Used by Message Class
| Attribute | Options |
|---|---|
MessageState |
|
PayloadType |
|
Table 13-26 Summary of Message Methods
| Method | Summary |
|---|---|
|
|
|
|
Retrieves |
|
|
Retrieves the number of attempts made to dequeue the message. |
|
|
Retrieves |
|
|
Retrieves the identification string. |
|
|
Retrieves delay with which message was enqueued. |
|
|
Retrieves name of queue to which |
|
|
Retrieves the expiration of the message. |
|
|
Retrieves time at which message was enqueued. |
|
|
Retrieves state of the message at time of enqueuing. |
|
|
Retrieves object payload of the message. |
|
|
Retrieves the Id of the message that generated this message on the last queue. |
|
|
Retrieves the type of the payload. |
|
|
Retrieves the priority of the message. |
|
|
Retrieves the agent who send the |
|
|
Tests whether the |
|
|
Assignment operator for |
|
|
Specifies |
|
|
Specifies |
|
|
Specifies the identification string. |
|
|
Specifies the number of seconds to delay the enqueued |
|
|
Specifies the name of the queue to which the |
|
|
Specifies the duration of time that |
|
|
Sets the |
|
|
Specifies object payload of the message. |
|
|
Specifies id of last queue that generated the |
|
|
Specifies priority of the |
|
|
Specifies the list of agents for whom the message is intended. |
|
|
Specifies the sender of the |
- Message()
- getAnyData()
- getAttemptsToDequeue()
- getBytes()
- getCorrelationId()
- getDelay()
- getExceptionQueueName()
- getExpiration()
- getMessageEnqueuedTime()
- getMessageState()
- getObject()
- getOriginalMessageId()
- getPayloadType()
- getPriority()
- getSenderId()
- isNull()
- operator=()
- setAnyData()
- setBytes()
- setCorrelationId()
- setDelay()
- setExceptionQueueName()
- setExpiration()
- setNull()
- setObject()
- setOriginalMessageId()
- setPriority()
- setRecipientList()
- setSenderId()
Parent topic: OCCI Application Programming Interface
Message()
Message class constructor.
| Syntax | Description |
|---|---|
Message( const Environment *env); |
Creates a |
Message( const Message& mes); |
Copy constructor. |
| Parameter | Description |
|---|---|
env |
The environment of the |
mes |
The original |
Parent topic: Message Class
getAnyData()
Retrieves the AnyData payload of the Message.
Syntax
AnyData getAnyData() const;
Parent topic: Message Class
getAttemptsToDequeue()
Retrieves the number of attempts made to dequeue the message. This property cannot be retrieved while enqueuing.
Syntax
int getAttemptsToDequeue() const;
Parent topic: Message Class
getBytes()
Retrieves Bytes payload of the Message.
Syntax
Bytes getBytes() const;
Parent topic: Message Class
getCorrelationId()
Retrieves the identification string.
Syntax
string getCorrelationId() const;
Parent topic: Message Class
getDelay()
Retrieves the delay (in seconds) with which the Message was enqueued.
Syntax
int getDelay() const;
Parent topic: Message Class
getExceptionQueueName()
Retrieves the name of the queue to which the Message is moved, in cases when the Message cannot be processed successfully.
Syntax
string getExceptionQueueName() const;
Parent topic: Message Class
getExpiration()
Retrieves the expiration time of the Message (in seconds). This is the duration for which the message is available for dequeuing.
Syntax
int getExpiration() const;
Parent topic: Message Class
getMessageEnqueuedTime()
Retrieves the time at which the message was enqueued, in Date format. This value is determined by the system, and cannot be set by the user.
Syntax
Date getMessageEnqueuedTime() const;
Parent topic: Message Class
getMessageState()
Retrieves the state of the message at the time of enqueuing. This parameter cannot be set an enqueuing time. MessageState is defined in Table 13-25.
Syntax
MessageState getMessageState() const;
Parent topic: Message Class
getObject()
Retrieves object payload of the Message.
Syntax
PObject* getObject();
Parent topic: Message Class
getOriginalMessageId()
Retrieves the original message Id. When a message is propagated from one queue to another, gets the ID to the last queue that generated this message.
Syntax
Bytes getOriginalMessageId() const;
Parent topic: Message Class
getPayloadType()
Retrieves the type of the payload, as defined for PayloadType in Table 13-25.
Syntax
PayloadType getPayloadType( ) const;
Parent topic: Message Class
getPriority()
Retrieves the priority of the Message.
Syntax
int getPriority() const;
Parent topic: Message Class
getSenderId()
Retrieves the agent who send the Message.
Syntax
Agent getSenderId() const;
Parent topic: Message Class
isNull()
Tests whether the Message object is NULL. If the Message object is NULL, then TRUE is returned; otherwise, FALSE is returned.
Syntax
bool isNull() const;
Parent topic: Message Class
operator=()
Assignment operator for Message.
void operator=( const Message& mes);
| Parameter | Description |
|---|---|
mes |
Original message. |
Parent topic: Message Class
setAnyData()
Specifies AnyData payload of the Message.
Syntax
void setAnyData( const AnyData& anydata);
| Parameter | Description |
|---|---|
anydata |
Data content of the |
Parent topic: Message Class
setBytes()
Specifies Bytes payload of the Message.
Syntax
void setBytes( const Bytes& bytes);
| Parameter | Description |
|---|---|
bytes |
Data content of the |
Parent topic: Message Class
setCorrelationId()
Specifies the identification string. This parameter is set at enqueuing time by the Producer. Messages can be dequeued with this id. The id can contain wildcard characters.
Syntax
void setCorrelationId( const string& id);
| Parameter | Description |
|---|---|
id |
The id; upper limit of |
Parent topic: Message Class
setDelay()
Specifies the time (in seconds) to delay the enqueued Message. After the delay ends, the Message is available for dequeuing.
Note that dequeuing by msgid overrides the delay specification. A Message enqueued with delay is in the WAITING state. Delay is set by the producer of the Message.
Syntax
void setDelay( int delay);
| Parameter | Description |
|---|---|
delay |
The delay. |
Parent topic: Message Class
setExceptionQueueName()
Specifies the name of the queue to which the Message object is moved if it cannot be processed successfully. The queue name must be valid.
Note that if the exception queue does not exist at the time of the move, the Message is moved to the default exception queue associated with the queue table; a warning is logged in the alert log.
Also note that if the default exception queue is used, the parameter returns a NULL value at enqueuing time; the attribute must refer to a valid queue name.
Syntax
void setExceptionQueueName( const string& queue);
| Parameter | Description |
|---|---|
queue |
The name of the exception queue. |
Parent topic: Message Class
setExpiration()
Specifies the duration time (in seconds) that the Message object is available for dequeuing. A Message expires after this time.
Syntax
void setExpiration( int exp);
| Parameter | Description |
|---|---|
exp |
The duration of expiration. |
Parent topic: Message Class
setNull()
Sets the Message object to NULL. Before the Connection is destroyed by the terminateConnection() call of the Environment Class, all Message objects must be set to NULL.
Syntax
void setNull();
Parent topic: Message Class
setObject()
Specifies object payload of the Message.
Syntax
void setObject( PObject& pobj);
| Parameter | Description |
|---|---|
pobj |
Content of the data |
Parent topic: Message Class
setOriginalMessageId()
Sets the Id of the last queue that generated the message, when a message is propagated from one queue to another.
Syntax
void setOriginalMessageId( const Bytes& queue);
| Parameter | Description |
|---|---|
queue |
The last queue. |
Parent topic: Message Class
setPriority()
Specifies the priority of the Message object. This property is set during enqueuing time, and can be negative. Default is 0.
Syntax
void setPriority( int priority);
| Parameter | Description |
|---|---|
priority |
The priority of the |
Parent topic: Message Class
setRecipientList()
Specifies the list of Agents for whom the Message is intended. These recipients are not identical to subscribers of the queue. The property is set during enqueuing. All Agents in the list must be valid. The recipient list overrides the default subscriber list.
Syntax
void setRecipientList( vector<Agent>& agentList);
| Parameter | Description |
|---|---|
agentList |
The list of |
Parent topic: Message Class
setSenderId()
Specifies the sender of the Message.
Syntax
void setSenderId( const Agent& sender);
| Parameter | Description |
|---|---|
sender |
Sender id. |
Parent topic: Message Class