class safmq::MessageQueue

A class representing a message queue.

Child Classes

A class representing a message queue. This class is intended to simplify access to message queues by providing reading and writing functionality.
Friends:
class MQFactory

This class has no child classes.

Public Methods

[more]ErrorCode AdvanceCursor(MQConnection::CursorHandle cursorID)
Advances the cursor to the next message in the queue
[more]ErrorCode CloseCursor(MQConnection::CursorHandle cursorID)
Closes a previously opened message cursor
[more]ErrorCode Enqueue(QueueMessage& msg)
Places the message msg on the queue specified by qhandle
[more]ErrorCode GetQueueStatistics(bool includeStorageBytes, bool includeMessageBytes, QueueStatistics& stats)
Retrieves performance statistics for the message queue
[more] MessageQueue(MQConnection* con, const std::string& qname, bool free_con) throw(ErrorCode)
Constructs the message queue from an already established connection
[more]ErrorCode OpenCursor(MQConnection::CursorHandle& cursorID)
Opens a message cursor for iterating through a message queue.
[more]ErrorCode PeekCursor(bool retrievebody, MQConnection::CursorHandle cursorID, QueueMessage& msg)
Retreives a message from the safmq server located by the passed cursor to the passed id and leaves it in the queue
[more]ErrorCode PeekFront(bool retrievebody, SAFMQ_INT32 timeout, QueueMessage& msg)
Retreives a message from the safmq server and leaves it in the queue
[more]ErrorCode PeekID(bool retrievebody, uuid& id, SAFMQ_INT32 timeout, QueueMessage& msg)
Retreives a message from the safmq server with a recipt id equal to the passed id and leaves it in the queue
[more]ErrorCode Retrieve(bool retrievebody, SAFMQ_INT32 timeout, QueueMessage& msg)
Retreives a message from the safmq server and removes it from the queue
[more]ErrorCode RetrieveCursor(bool retrievebody, MQConnection::CursorHandle cursorID, QueueMessage& msg)
Retreives a message from the safmq server located by the passed cursor to the passed id and removes it from the queue
[more]ErrorCode RetrieveID(bool retrievebody, uuid& id, SAFMQ_INT32 timeout, QueueMessage& msg)
Retreives a message from the safmq server with a recipt id equal to the passed id and removes it from the queue
[more]ErrorCode SeekID(uuid& id, SAFMQ_INT32 timeout, MQConnection::CursorHandle cursorID)
Locates a message from the safmq server with a recipt id equal to the passed id and points the cursor at it
[more]ErrorCode TestCursor(MQConnection::CursorHandle cursorID)
Determines if a cursor is valid
[more] ~MessageQueue()
Closes the message queue and optionally frees the associated MQConnection

Member Documentation


MessageQueue (MQConnection* con, const std::string& qname, bool free_con) throw(ErrorCode)
Constructs the message queue from an already established connection
Throws:
ErrorCode - Thrown incase of an error opening the queue
Parameters:
con - [in] A connection to a safmq message queue server
qname - [in] The name of a message queue to be opened
free_con - [in] Indicates the connection should be freed when the object is destroyed


~MessageQueue ()
Closes the message queue and optionally frees the associated MQConnection


ErrorCode GetQueueStatistics (bool includeStorageBytes, bool includeMessageBytes, QueueStatistics& stats)
Retrieves performance statistics for the message queue
Parameters:
includeStorageBytes - [in] Requests storage bytes (on disk including purged messages) returned
includeMessageBytes - [in] Requests message bytes, bytes in queue (excluding purged messages)
stats - [out] Statistics about a queue
Returns:
EC_NOERROR, EC_NOTOPEN, EC_NETWORKERROR


ErrorCode Enqueue (QueueMessage& msg)
Places the message msg on the queue specified by qhandle
Parameters:
msg - [in/out] The message to be sent to the server, the message id and timestamp will be set by the server upon success
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTAUTHORIZED, EC_WRONGMESSAGETYPE


ErrorCode Retrieve (bool retrievebody, SAFMQ_INT32 timeout, QueueMessage& msg)
Retreives a message from the safmq server and removes it from the queue
Parameters:
retreivebody - [in] Flags the server to retreive the message body
timeoutseconds - [in] The number of seconds to wait for a message to be published on the queue in the case the queue is empty. -1 causes an indefinate wait.
msg - [in] The message to be sent to the server, the message id and timestamp will be set by the server upon success
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTAUTHORIZED, EC_NOMOREMESSAGES, EC_TIMEDOUT


ErrorCode RetrieveID (bool retrievebody, uuid& id, SAFMQ_INT32 timeout, QueueMessage& msg)
Retreives a message from the safmq server with a recipt id equal to the passed id and removes it from the queue
Parameters:
retreivebody - [in] Flags the server to retreive the message body
id - [in] The uuid recipt id of a message to search for in the message queue
timeoutseconds - [in] The number of seconds to wait for a message to be published on the queue in the case the queue is empty. -1 causes an indefinate wait.
msg - [in] The message to be sent to the server, the message id and timestamp will be set by the server upon success
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTAUTHORIZED, EC_TIMEDOUT


ErrorCode RetrieveCursor (bool retrievebody, MQConnection::CursorHandle cursorID, QueueMessage& msg)
Retreives a message from the safmq server located by the passed cursor to the passed id and removes it from the queue
Parameters:
qhandle - [in] A handle to a previously opened queue
retreivebody - [in] Flags the server to retreive the message body
cursorID - [in] The id of a queue cursor point to the message to be retreived
msg - [in] The message to be sent to the server, the message id and timestamp will be set by the server upon success
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTOPEN, EC_INVALIDCURSOR


ErrorCode PeekFront (bool retrievebody, SAFMQ_INT32 timeout, QueueMessage& msg)
Retreives a message from the safmq server and leaves it in the queue
Parameters:
retreivebody - [in] Flags the server to retreive the message body
timeoutseconds - [in] The number of seconds to wait for a message to be published on the queue in the case the queue is empty. -1 causes an indefinate wait.
msg - [in] The message to be sent to the server, the message id and timestamp will be set by the server upon success
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTAUTHORIZED, EC_NOMOREMESSAGES, EC_TIMEDOUT


ErrorCode PeekID (bool retrievebody, uuid& id, SAFMQ_INT32 timeout, QueueMessage& msg)
Retreives a message from the safmq server with a recipt id equal to the passed id and leaves it in the queue
Parameters:
retreivebody - [in] Flags the server to retreive the message body
id - [in] The uuid recipt id of a message to search for in the message queue
timeoutseconds - [in] The number of seconds to wait for a message to be published on the queue in the case the queue is empty. -1 causes an indefinate wait.
msg - [in] The message to be sent to the server, the message id and timestamp will be set by the server upon success
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTAUTHORIZED, EC_TIMEDOUT


ErrorCode PeekCursor (bool retrievebody, MQConnection::CursorHandle cursorID, QueueMessage& msg)
Retreives a message from the safmq server located by the passed cursor to the passed id and leaves it in the queue
Parameters:
retreivebody - [in] Flags the server to retreive the message body
cursorID - [in] The id of a queue cursor point to the message to be retreived
msg - [in] The message to be sent to the server, the message id and timestamp will be set by the server upon success
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTOPEN, EC_INVALIDCURSOR


ErrorCode OpenCursor (MQConnection::CursorHandle& cursorID)
Opens a message cursor for iterating through a message queue. The cursor is positioned initially at the first message in the queue.
Parameters:
cursorID - [out] Receives the id of the new cursor
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTAUTHORIZED, EC_NOTOPEN


ErrorCode CloseCursor (MQConnection::CursorHandle cursorID)
Closes a previously opened message cursor
Parameters:
cursorID - [in] The id of the cursor to close
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTOPEN


ErrorCode AdvanceCursor (MQConnection::CursorHandle cursorID)
Advances the cursor to the next message in the queue
Parameters:
cursorID - [in] The id of the cursor to advance
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTOPEN, EC_NOMOREMESSAGES


ErrorCode SeekID (uuid& id, SAFMQ_INT32 timeout, MQConnection::CursorHandle cursorID)
Locates a message from the safmq server with a recipt id equal to the passed id and points the cursor at it
Parameters:
id - [in] The uuid recipt id of a message to search for in the message queue
timeoutseconds - [in] The number of seconds to wait for a message to be published on the queue in the case the queue is empty. -1 causes an indefinate wait.
cursorID - [in] The id of the cursor to advance
Returns:
EC_NOERROR, EC_NETWORKERROR, EC_NOTAUTHORIZED, EC_TIMEDOUT


ErrorCode TestCursor (MQConnection::CursorHandle cursorID)
Determines if a cursor is valid
Parameters:
cursorID - [in] A previously opened cursor
Returns:
EC_NETWORKERROR, EC_NOTOPEN, EC_INVALIDCURSOR

Table of Contents HTML hierarchy of classes or Java


Safmq Documentation, copyright (c) 2004-2010 Matthew J. Battey, Licensed Under Apache License Ver 2.0
Powered By: Get SAFMQ: Store and Forward Message Queue at SourceForge.net. Fast, secure and Free Open Source software downloads