#include <src/main/cms/MessageConsumer.h>
MessageConsumer
to received messages from a destination.
A client may either synchronously receive a message consumer's messages or have the consumer asynchronously deliver them as they arrive.
For synchronous receipt, a client can request the next message from a message consumer using one of its receive
methods. There are several variations of receive
that allow a client to poll or wait for the next message.
For asynchronous delivery, a client can register a MessageListener
object with a message consumer. As messages arrive at the message consumer, it delivers them by calling the MessageListener
's onMessage
method.
Public Member Functions | |
virtual | ~MessageConsumer () |
virtual Message * | receive ()=0 throw ( CMSException ) |
Synchronously Receive a Message. | |
virtual Message * | receive (int millisecs)=0 throw ( CMSException ) |
Synchronously Receive a Message, time out after defined interval. | |
virtual Message * | receiveNoWait ()=0 throw ( CMSException ) |
Receive a Message, does not wait if there isn't a new message to read, returns NULL if nothing read. | |
virtual void | setMessageListener (MessageListener *listener)=0 |
Sets the MessageListener that this class will send notifs on. | |
virtual MessageListener * | getMessageListener () const =0 |
Gets the MessageListener that this class will send notifs on. | |
virtual std::string | getMessageSelector () const =0 throw ( cms::CMSException ) |
Gets this message consumer's message selector expression. |
virtual cms::MessageConsumer::~MessageConsumer | ( | ) | [inline, virtual] |
virtual Message* cms::MessageConsumer::receive | ( | ) | throw ( CMSException ) [pure virtual] |
virtual Message* cms::MessageConsumer::receive | ( | int | millisecs | ) | throw ( CMSException ) [pure virtual] |
Synchronously Receive a Message, time out after defined interval.
Returns null if nothing read.
CMSException |
virtual Message* cms::MessageConsumer::receiveNoWait | ( | ) | throw ( CMSException ) [pure virtual] |
Receive a Message, does not wait if there isn't a new message to read, returns NULL if nothing read.
CMSException |
virtual void cms::MessageConsumer::setMessageListener | ( | MessageListener * | listener | ) | [pure virtual] |
Sets the MessageListener that this class will send notifs on.
listener | The listener of messages received by this consumer. |
virtual MessageListener* cms::MessageConsumer::getMessageListener | ( | ) | const [pure virtual] |
Gets the MessageListener that this class will send notifs on.
virtual std::string cms::MessageConsumer::getMessageSelector | ( | ) | const throw ( cms::CMSException ) [pure virtual] |
Gets this message consumer's message selector expression.
cms::CMSException |