activemq-cpp-3.6.0
activemq::core::ActiveMQConsumer Class Reference

#include <src/main/activemq/core/ActiveMQConsumer.h>

Inheritance diagram for activemq::core::ActiveMQConsumer:

Public Member Functions

 ActiveMQConsumer (const Pointer< activemq::core::kernels::ActiveMQConsumerKernel > &kernel)
 Create a new ActiveMQConsumer that contains the pointer to the Kernel that implement the real MessageConsumer functionality.
virtual ~ActiveMQConsumer ()
virtual void start ()
 Starts the service.
virtual void stop ()
 Stops this service.
virtual void close ()
 Closes this object and deallocates the appropriate resources.
virtual cms::Messagereceive ()
 Synchronously Receive a Message.
virtual cms::Messagereceive (int millisecs)
 Synchronously Receive a Message, time out after defined interval.
virtual cms::MessagereceiveNoWait ()
 Receive a Message, does not wait if there isn't a new message to read, returns NULL if nothing read.
virtual void setMessageListener (cms::MessageListener *listener)
 Sets the MessageListener that this class will send notifs on.
virtual cms::MessageListenergetMessageListener () const
 Gets the MessageListener that this class will send mew Message notification events to.
virtual void setMessageAvailableListener (cms::MessageAvailableListener *listener)
 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
 Gets the MessageAvailableListener that this class will send mew Message notification events to.
virtual std::string getMessageSelector () const
 Gets this message consumer's message selector expression.
virtual void setMessageTransformer (cms::MessageTransformer *transformer)
 Set an MessageTransformer instance that is applied to all cms::Message objects before they are dispatched to client code.
virtual cms::MessageTransformergetMessageTransformer () const
 Gets the currently configured MessageTransformer for this MessageConsumer.
const Pointer
< commands::ConsumerInfo > & 
getConsumerInfo () const
 Get the Consumer information for this consumer.
const Pointer
< commands::ConsumerId > & 
getConsumerId () const
 Get the Consumer Id for this consumer.
bool isClosed () const
int getMessageAvailableCount () const
void setRedeliveryPolicy (RedeliveryPolicy *policy)
 Sets the RedeliveryPolicy this Consumer should use when a rollback is performed on a transacted Consumer.
RedeliveryPolicygetRedeliveryPolicy () const
 Gets a pointer to this Consumer's Redelivery Policy object, the Consumer retains ownership of this pointer so the caller should not delete it.
decaf::lang::ExceptiongetFailureError () const
 Gets the error that caused this Consumer to be in a Failed state, or NULL if there is no Error.
- Public Member Functions inherited from cms::MessageConsumer
virtual ~MessageConsumer ()
- Public Member Functions inherited from cms::Closeable
virtual ~Closeable ()
- Public Member Functions inherited from cms::Startable
virtual ~Startable ()
- Public Member Functions inherited from cms::Stoppable
virtual ~Stoppable ()

Constructor & Destructor Documentation

activemq::core::ActiveMQConsumer::ActiveMQConsumer ( const Pointer< activemq::core::kernels::ActiveMQConsumerKernel > &  kernel)

Create a new ActiveMQConsumer that contains the pointer to the Kernel that implement the real MessageConsumer functionality.

Parameters
ActiveMQConsumerKernelThis Consumer's functionality kernel.
virtual activemq::core::ActiveMQConsumer::~ActiveMQConsumer ( )
virtual

Member Function Documentation

virtual void activemq::core::ActiveMQConsumer::close ( )
virtual

Closes this object and deallocates the appropriate resources.

The object is generally no longer usable after calling close.

Exceptions
CMSException- If an error occurs while the resource is being closed.

Implements cms::Closeable.

const Pointer<commands::ConsumerId>& activemq::core::ActiveMQConsumer::getConsumerId ( ) const

Get the Consumer Id for this consumer.

Returns
Reference to a Consumer Id Object
const Pointer<commands::ConsumerInfo>& activemq::core::ActiveMQConsumer::getConsumerInfo ( ) const

Get the Consumer information for this consumer.

Returns
Reference to a Consumer Info Object
decaf::lang::Exception* activemq::core::ActiveMQConsumer::getFailureError ( ) const

Gets the error that caused this Consumer to be in a Failed state, or NULL if there is no Error.

Returns
pointer to the error that faulted this Consumer or NULL.
int activemq::core::ActiveMQConsumer::getMessageAvailableCount ( ) const
Returns
the number of Message's this consumer is waiting to Dispatch.
virtual cms::MessageAvailableListener* activemq::core::ActiveMQConsumer::getMessageAvailableListener ( ) const
virtual

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

Returns
The listener of message events received by this consumer.
Exceptions
CMSException- If an internal error occurs.

Implements cms::MessageConsumer.

virtual cms::MessageListener* activemq::core::ActiveMQConsumer::getMessageListener ( ) const
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.

Implements cms::MessageConsumer.

virtual std::string activemq::core::ActiveMQConsumer::getMessageSelector ( ) const
virtual

Gets this message consumer's message selector expression.

Returns
This Consumer's selector expression or "".
Exceptions
CMSException- If an internal error occurs.

Implements cms::MessageConsumer.

virtual cms::MessageTransformer* activemq::core::ActiveMQConsumer::getMessageTransformer ( ) const
virtual

Gets the currently configured MessageTransformer for this MessageConsumer.

Returns
the pointer to the currently set cms::MessageTransformer.

Implements cms::MessageConsumer.

RedeliveryPolicy* activemq::core::ActiveMQConsumer::getRedeliveryPolicy ( ) const

Gets a pointer to this Consumer's Redelivery Policy object, the Consumer retains ownership of this pointer so the caller should not delete it.

Returns
a Pointer to a RedeliveryPolicy that is in use by this Consumer.
bool activemq::core::ActiveMQConsumer::isClosed ( ) const
Returns
if this Consumer has been closed.
virtual cms::Message* activemq::core::ActiveMQConsumer::receive ( )
virtual

Synchronously Receive a Message.

Returns
new message which the caller owns and must delete.
Exceptions
CMSException- If an internal error occurs.

Implements cms::MessageConsumer.

virtual cms::Message* activemq::core::ActiveMQConsumer::receive ( int  millisecs)
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.

Implements cms::MessageConsumer.

virtual cms::Message* activemq::core::ActiveMQConsumer::receiveNoWait ( )
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.

Implements cms::MessageConsumer.

virtual void activemq::core::ActiveMQConsumer::setMessageAvailableListener ( cms::MessageAvailableListener listener)
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.

Parameters
listenerThe listener of new message events fired by this consumer.
Exceptions
CMSException- If an internal error occurs.

Implements cms::MessageConsumer.

virtual void activemq::core::ActiveMQConsumer::setMessageListener ( cms::MessageListener listener)
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.

Implements cms::MessageConsumer.

virtual void activemq::core::ActiveMQConsumer::setMessageTransformer ( cms::MessageTransformer transformer)
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.

Parameters
transformerPointer to the cms::MessageTransformer to apply on each cms:;Message dispatch.

Implements cms::MessageConsumer.

void activemq::core::ActiveMQConsumer::setRedeliveryPolicy ( RedeliveryPolicy policy)

Sets the RedeliveryPolicy this Consumer should use when a rollback is performed on a transacted Consumer.

The Consumer takes ownership of the passed pointer. The Consumer's redelivery policy can never be null, a call to this method with a NULL pointer is ignored.

Parameters
policyPointer to a Redelivery Policy object that his Consumer will use.
virtual void activemq::core::ActiveMQConsumer::start ( )
virtual

Starts the service.

Exceptions
CMSExceptionif an internal error occurs while starting.

Implements cms::Startable.

virtual void activemq::core::ActiveMQConsumer::stop ( )
virtual

Stops this service.

Exceptions
CMSException- if an internal error occurs while stopping the Service.

Implements cms::Stoppable.


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