activemq-cpp-3.4.0
|
A client uses a MessageConsumer
to received messages from a destination.
More...
#include <src/main/cms/MessageConsumer.h>
Public Member Functions | |
virtual | ~MessageConsumer () throw () |
virtual Message * | receive ()=0 |
Synchronously Receive a Message. | |
virtual Message * | receive (int millisecs)=0 |
Synchronously Receive a Message, time out after defined interval. | |
virtual Message * | receiveNoWait ()=0 |
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 mew Message notification events to. | |
virtual std::string | getMessageSelector () const =0 |
Gets this message consumer's message selector expression. |
A client uses a 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.
When the MessageConsumer's close method is called the method can block while an asynchronous message delivery is in progress or until a receive
operation completes. A blocked consumer in a receive
call will return a Null when the close method is called.
While the MessageConsumer implements the Startable and Stoppable interfaces it is not required to implement these methods and can throw an UnsupportedOperation exception if they are not available for the given CMS provider.
virtual cms::MessageConsumer::~MessageConsumer | ( | ) | throw () [virtual] |
virtual MessageListener* cms::MessageConsumer::getMessageListener | ( | ) | const [pure virtual] |
Gets the MessageListener that this class will send mew Message notification events to.
CMSException | - If an internal error occurs. |
Implemented in activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.
virtual std::string cms::MessageConsumer::getMessageSelector | ( | ) | const [pure virtual] |
Gets this message consumer's message selector expression.
CMSException | - If an internal error occurs. |
Implemented in activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.
virtual Message* cms::MessageConsumer::receive | ( | int | millisecs | ) | [pure virtual] |
Synchronously Receive a Message, time out after defined interval.
Returns null if nothing read.
CMSException | - If an internal error occurs. |
Implemented in activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.
virtual Message* cms::MessageConsumer::receive | ( | ) | [pure virtual] |
Synchronously Receive a Message.
CMSException | - If an internal error occurs. |
Implemented in activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.
virtual Message* cms::MessageConsumer::receiveNoWait | ( | ) | [pure virtual] |
Receive a Message, does not wait if there isn't a new message to read, returns NULL if nothing read.
CMSException | - If an internal error occurs. |
Implemented in activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.
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. |
CMSException | - If an internal error occurs. |
Implemented in activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.