activemq-cpp-3.6.0
|
#include <src/main/activemq/core/kernels/ActiveMQConsumerKernel.h>
Public Member Functions | |
ActiveMQConsumerKernel (ActiveMQSessionKernel *session, const Pointer< commands::ConsumerId > &id, const Pointer< commands::ActiveMQDestination > &destination, const std::string &name, const std::string &selector, int prefetch, int maxPendingMessageCount, bool noLocal, bool browser, bool dispatchAsync, cms::MessageListener *listener) | |
virtual | ~ActiveMQConsumerKernel () |
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::Message * | receive () |
Synchronously Receive a Message. | |
virtual cms::Message * | receive (int millisecs) |
Synchronously Receive a Message, time out after defined interval. | |
virtual cms::Message * | receiveNoWait () |
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::MessageListener * | getMessageListener () 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 | acknowledge (const Pointer< commands::MessageDispatch > &dispatch) |
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::MessageTransformer * | getMessageTransformer () const |
Gets the currently configured MessageTransformer for this MessageConsumer. | |
virtual void | dispatch (const Pointer< MessageDispatch > &message) |
Dispatches a message to a particular consumer. | |
void | acknowledge () |
Method called to acknowledge all messages that have been received so far. | |
void | commit () |
Called to Commit the current set of messages in this Transaction. | |
void | rollback () |
Called to Roll back the current set of messages in this Transaction. | |
void | doClose () |
Performs the actual close operation on this consumer. | |
void | dispose () |
Cleans up this objects internal resources. | |
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 |
bool | isSynchronizationRegistered () const |
Has this Consumer Transaction Synchronization been added to the transaction. | |
void | setSynchronizationRegistered (bool value) |
Sets the Synchronization Registered state of this consumer. | |
bool | iterate () |
Deliver any pending messages to the registered MessageListener if there is one, return true if not all dispatched, or false if no listener or all pending messages have been dispatched. | |
void | deliverAcks () |
Forces this consumer to send all pending acks to the broker. | |
void | clearMessagesInProgress () |
Called on a Failover to clear any pending messages. | |
void | inProgressClearRequired () |
Signals that a Failure occurred and that anything in-progress in the consumer should be cleared. | |
long long | getLastDeliveredSequenceId () const |
Gets the currently set Last Delivered Sequence Id. | |
void | setLastDeliveredSequenceId (long long value) |
Sets the value of the Last Delivered Sequence Id. | |
int | getMessageAvailableCount () const |
void | setRedeliveryPolicy (RedeliveryPolicy *policy) |
Sets the RedeliveryPolicy this Consumer should use when a rollback is performed on a transacted Consumer. | |
RedeliveryPolicy * | 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. | |
void | setFailureError (decaf::lang::Exception *error) |
Sets the Exception that has caused this Consumer to be in a failed state. | |
decaf::lang::Exception * | getFailureError () const |
Gets the error that caused this Consumer to be in a Failed state, or NULL if there is no Error. | |
void | setPrefetchSize (int prefetchSize) |
Sets the current prefetch size for the consumer as indicated by a Broker ConsumerControl command. | |
bool | isInUse (Pointer< commands::ActiveMQDestination > destination) const |
Checks if the given destination is the Destination that this Consumer is subscribed to. | |
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 () |
Public Member Functions inherited from activemq::core::Dispatcher | |
virtual | ~Dispatcher () |
Protected Member Functions | |
Pointer< MessageDispatch > | dequeue (long long timeout) |
Used by synchronous receive methods to wait for messages to come in. | |
void | beforeMessageIsConsumed (const Pointer< commands::MessageDispatch > &dispatch) |
Pre-consume processing. | |
void | afterMessageIsConsumed (const Pointer< commands::MessageDispatch > &dispatch, bool messageExpired) |
Post-consume processing. |
activemq::core::kernels::ActiveMQConsumerKernel::ActiveMQConsumerKernel | ( | ActiveMQSessionKernel * | session, |
const Pointer< commands::ConsumerId > & | id, | ||
const Pointer< commands::ActiveMQDestination > & | destination, | ||
const std::string & | name, | ||
const std::string & | selector, | ||
int | prefetch, | ||
int | maxPendingMessageCount, | ||
bool | noLocal, | ||
bool | browser, | ||
bool | dispatchAsync, | ||
cms::MessageListener * | listener | ||
) |
|
virtual |
|
virtual |
void activemq::core::kernels::ActiveMQConsumerKernel::acknowledge | ( | ) |
Method called to acknowledge all messages that have been received so far.
CMSException | if an error occurs while ack'ing the message. |
|
protected |
Post-consume processing.
dispatch | - the consumed message |
messageExpired | - flag indicating if the message has expired. |
|
protected |
Pre-consume processing.
dispatch | - the message being consumed. |
void activemq::core::kernels::ActiveMQConsumerKernel::clearMessagesInProgress | ( | ) |
Called on a Failover to clear any pending messages.
|
virtual |
Closes this object and deallocates the appropriate resources.
The object is generally no longer usable after calling close.
CMSException | - If an error occurs while the resource is being closed. |
Implements cms::Closeable.
void activemq::core::kernels::ActiveMQConsumerKernel::commit | ( | ) |
Called to Commit the current set of messages in this Transaction.
ActiveMQException | if an error occurs while performing the operation. |
void activemq::core::kernels::ActiveMQConsumerKernel::deliverAcks | ( | ) |
Forces this consumer to send all pending acks to the broker.
ActiveMQException | if an error occurs while performing the operation. |
|
protected |
Used by synchronous receive methods to wait for messages to come in.
timeout | - The maximum number of milliseconds to wait before returning. |
If -1, it will block until a messages is received or this consumer is closed. If 0, will not block at all. If > 0, will wait at a maximum the specified number of milliseconds before returning.
InvalidStateException | if this consumer is closed upon entering this method. |
|
virtual |
Dispatches a message to a particular consumer.
message | The message to be dispatched to a waiting consumer. |
Implements activemq::core::Dispatcher.
void activemq::core::kernels::ActiveMQConsumerKernel::dispose | ( | ) |
Cleans up this objects internal resources.
ActiveMQException | if an error occurs while performing the operation. |
void activemq::core::kernels::ActiveMQConsumerKernel::doClose | ( | ) |
Performs the actual close operation on this consumer.
ActiveMQException | if an error occurs while performing the operation. |
const Pointer<commands::ConsumerId>& activemq::core::kernels::ActiveMQConsumerKernel::getConsumerId | ( | ) | const |
Get the Consumer Id for this consumer.
const Pointer<commands::ConsumerInfo>& activemq::core::kernels::ActiveMQConsumerKernel::getConsumerInfo | ( | ) | const |
Get the Consumer information for this consumer.
decaf::lang::Exception* activemq::core::kernels::ActiveMQConsumerKernel::getFailureError | ( | ) | const |
Gets the error that caused this Consumer to be in a Failed state, or NULL if there is no Error.
long long activemq::core::kernels::ActiveMQConsumerKernel::getLastDeliveredSequenceId | ( | ) | const |
Gets the currently set Last Delivered Sequence Id.
int activemq::core::kernels::ActiveMQConsumerKernel::getMessageAvailableCount | ( | ) | const |
|
virtual |
Gets the MessageAvailableListener that this class will send mew Message notification events to.
CMSException | - If an internal error occurs. |
Implements cms::MessageConsumer.
|
virtual |
Gets the MessageListener that this class will send mew Message notification events to.
CMSException | - If an internal error occurs. |
Implements cms::MessageConsumer.
|
virtual |
Gets this message consumer's message selector expression.
CMSException | - If an internal error occurs. |
Implements cms::MessageConsumer.
|
virtual |
Gets the currently configured MessageTransformer for this MessageConsumer.
Implements cms::MessageConsumer.
RedeliveryPolicy* activemq::core::kernels::ActiveMQConsumerKernel::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.
void activemq::core::kernels::ActiveMQConsumerKernel::inProgressClearRequired | ( | ) |
Signals that a Failure occurred and that anything in-progress in the consumer should be cleared.
bool activemq::core::kernels::ActiveMQConsumerKernel::isClosed | ( | ) | const |
bool activemq::core::kernels::ActiveMQConsumerKernel::isInUse | ( | Pointer< commands::ActiveMQDestination > | destination | ) | const |
Checks if the given destination is the Destination that this Consumer is subscribed to.
bool activemq::core::kernels::ActiveMQConsumerKernel::isSynchronizationRegistered | ( | ) | const |
Has this Consumer Transaction Synchronization been added to the transaction.
bool activemq::core::kernels::ActiveMQConsumerKernel::iterate | ( | ) |
Deliver any pending messages to the registered MessageListener if there is one, return true if not all dispatched, or false if no listener or all pending messages have been dispatched.
|
virtual |
Synchronously Receive a Message.
CMSException | - If an internal error occurs. |
Implements cms::MessageConsumer.
|
virtual |
Synchronously Receive a Message, time out after defined interval.
Returns null if nothing read.
CMSException | - If an internal error occurs. |
Implements cms::MessageConsumer.
|
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. |
Implements cms::MessageConsumer.
void activemq::core::kernels::ActiveMQConsumerKernel::rollback | ( | ) |
Called to Roll back the current set of messages in this Transaction.
ActiveMQException | if an error occurs while performing the operation. |
void activemq::core::kernels::ActiveMQConsumerKernel::setFailureError | ( | decaf::lang::Exception * | error | ) |
Sets the Exception that has caused this Consumer to be in a failed state.
error | The error that is to be thrown when a Receive call is made. |
void activemq::core::kernels::ActiveMQConsumerKernel::setLastDeliveredSequenceId | ( | long long | value | ) |
Sets the value of the Last Delivered Sequence Id.
value | The new value to assign to the Last Delivered Sequence Id property. |
|
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. |
Implements cms::MessageConsumer.
|
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. |
Implements cms::MessageConsumer.
|
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. |
Implements cms::MessageConsumer.
void activemq::core::kernels::ActiveMQConsumerKernel::setPrefetchSize | ( | int | prefetchSize | ) |
Sets the current prefetch size for the consumer as indicated by a Broker ConsumerControl command.
void activemq::core::kernels::ActiveMQConsumerKernel::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.
policy | Pointer to a Redelivery Policy object that his Consumer will use. |
void activemq::core::kernels::ActiveMQConsumerKernel::setSynchronizationRegistered | ( | bool | value | ) |
Sets the Synchronization Registered state of this consumer.
value | - true if registered false otherwise. |
|
virtual |
Starts the service.
CMSException | if an internal error occurs while starting. |
Implements cms::Startable.
|
virtual |
Stops this service.
CMSException | - if an internal error occurs while stopping the Service. |
Implements cms::Stoppable.