activemq-cpp-3.6.0
|
A client uses a MessageConsumer
to received messages from a destination.
More...
#include <src/main/cms/MessageConsumer.h>
Public Member Functions | |
virtual | ~MessageConsumer () |
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. | |
virtual void | setMessageTransformer (cms::MessageTransformer *transformer)=0 |
Set an MessageTransformer instance that is applied to all cms::Message objects before they are dispatched to client code. | |
virtual cms::MessageTransformer * | getMessageTransformer () const =0 |
Gets the currently configured MessageTransformer for this MessageConsumer. | |
virtual void | setMessageAvailableListener (cms::MessageAvailableListener *listener)=0 |
Sets the MessageAvailableListener that this class will send events to if the consumer is in synchronous consumption mode and a new Message has arrived. | |
virtual cms::MessageAvailableListener * | getMessageAvailableListener () const =0 |
Gets the MessageAvailableListener that this class will send mew Message notification events to. | |
![]() | |
virtual | ~Closeable () |
virtual void | close ()=0 |
Closes this object and deallocates the appropriate resources. | |
![]() | |
virtual | ~Startable () |
virtual void | start ()=0 |
Starts the service. | |
![]() | |
virtual | ~Stoppable () |
virtual void | stop ()=0 |
Stops this service. |
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 |
|
pure virtual |
Gets the MessageAvailableListener that this class will send mew Message notification events to.
CMSException | - If an internal error occurs. |
Implemented in activemq::core::kernels::ActiveMQConsumerKernel, activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.
Referenced by activemq::cmsutil::CachedConsumer::getMessageAvailableListener().
|
pure virtual |
Gets the MessageListener that this class will send mew Message notification events to.
CMSException | - If an internal error occurs. |
Implemented in activemq::core::kernels::ActiveMQConsumerKernel, activemq::core::ActiveMQConsumer, and activemq::cmsutil::CachedConsumer.
Referenced by activemq::cmsutil::CachedConsumer::getMessageListener().
|
pure virtual |
Gets this message consumer's message selector expression.
CMSException | - If an internal error occurs. |
Implemented in activemq::core::kernels::ActiveMQConsumerKernel, activemq::core::ActiveMQConsumer, and activemq::cmsutil::CachedConsumer.
Referenced by activemq::cmsutil::CachedConsumer::getMessageSelector().
|
pure virtual |
Gets the currently configured MessageTransformer for this MessageConsumer.
Implemented in activemq::core::kernels::ActiveMQConsumerKernel, activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.
Referenced by activemq::cmsutil::CachedConsumer::getMessageTransformer().
|
pure virtual |
Synchronously Receive a Message.
CMSException | - If an internal error occurs. |
Implemented in activemq::core::kernels::ActiveMQConsumerKernel, activemq::core::ActiveMQConsumer, and activemq::cmsutil::CachedConsumer.
Referenced by activemq::cmsutil::CachedConsumer::receive().
|
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::core::kernels::ActiveMQConsumerKernel, activemq::core::ActiveMQConsumer, and activemq::cmsutil::CachedConsumer.
|
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::core::kernels::ActiveMQConsumerKernel, activemq::core::ActiveMQConsumer, and activemq::cmsutil::CachedConsumer.
Referenced by activemq::cmsutil::CachedConsumer::receiveNoWait().
|
pure virtual |
Sets the MessageAvailableListener that this class will send events to if the consumer is in synchronous consumption mode and a new Message has arrived.
listener | The listener of new message events fired by this consumer. |
CMSException | - If an internal error occurs. |
Implemented in activemq::core::kernels::ActiveMQConsumerKernel, activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.
Referenced by activemq::cmsutil::CachedConsumer::setMessageAvailableListener().
|
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::core::kernels::ActiveMQConsumerKernel, activemq::core::ActiveMQConsumer, and activemq::cmsutil::CachedConsumer.
Referenced by activemq::cmsutil::CachedConsumer::setMessageListener().
|
pure virtual |
Set an MessageTransformer instance that is applied to all cms::Message objects before they are dispatched to client code.
The CMS code never takes ownership of the MessageTransformer pointer which implies that the client code must ensure that the object remains valid for the lifetime of the CMS object to which the MessageTransformer has been assigned.
transformer | Pointer to the cms::MessageTransformer to apply on each cms:;Message dispatch. |
Implemented in activemq::core::kernels::ActiveMQConsumerKernel, activemq::cmsutil::CachedConsumer, and activemq::core::ActiveMQConsumer.
Referenced by activemq::cmsutil::CachedConsumer::setMessageTransformer().