activemq-cpp-3.4.0

cms::MessageConsumer Class Reference

A client uses a MessageConsumer to received messages from a destination. More...

#include <src/main/cms/MessageConsumer.h>

Inheritance diagram for cms::MessageConsumer:

Public Member Functions

virtual ~MessageConsumer () throw ()
virtual Messagereceive ()=0
 Synchronously Receive a Message.
virtual Messagereceive (int millisecs)=0
 Synchronously Receive a Message, time out after defined interval.
virtual MessagereceiveNoWait ()=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 MessageListenergetMessageListener () 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.

Detailed Description

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.

See also:
MessageListener
Since:
1.0

Constructor & Destructor Documentation

virtual cms::MessageConsumer::~MessageConsumer ( ) throw () [virtual]

Member Function Documentation

virtual MessageListener* cms::MessageConsumer::getMessageListener ( ) const [pure virtual]

Gets the MessageListener that this class will send mew Message notification events to.

Returns:
The listener of messages received by this consumer
Exceptions:
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.

Returns:
This Consumer's selector expression or "".
Exceptions:
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.

Returns:
new message which the caller owns and must delete.
Exceptions:
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.

Returns:
new message which the caller owns and must delete.
Exceptions:
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.

Returns:
new message which the caller owns and must delete.
Exceptions:
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.

Parameters:
listenerThe listener of messages received by this consumer.
Exceptions:
CMSException- If an internal error occurs.

Implemented in activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.


The documentation for this class was generated from the following file: