activemq::core::kernels::ActiveMQConsumerKernel Class Reference

#include <src/main/activemq/core/kernels/ActiveMQConsumerKernel.h>

Inheritance diagram for activemq::core::kernels::ActiveMQConsumerKernel:
Inheritance graph
[legend]

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::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.
virtual void dispatch (const Pointer< MessageDispatch > &message)
 Dispatches a message to a particular consumer.
virtual int getHashCode () const
 HashCode method allowing Dispatcher instances to be used in HashMap etc.
void acknowledge ()
 Method called to acknowledge all messages that have been received so far.
void acknowledge (Pointer< commands::MessageDispatch > dispatch)
 Method called to acknowledge the Message contained in the given MessageDispatch.
void acknowledge (Pointer< commands::MessageDispatch > dispatch, int ackType)
 Method called to acknowledge the Message contained in the given MessageDispatch.
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.
bool isTransactedIndividualAck () const
 Will Message's in a transaction be acknowledged using the Individual Acknowledge mode.
void setTransactedIndividualAck (bool value)
 Set if Message's in a transaction be acknowledged using the Individual Acknowledge mode.
long long setFailoverRedeliveryWaitPeriod () const
 Returns the delay after a failover before Message redelivery starts.
void setFailoverRedeliveryWaitPeriod (long long value)
 Sets the time in milliseconds to delay after failover before starting message redelivery.
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.
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.
void setFailureError (decaf::lang::Exception *error)
 Sets the Exception that has caused this Consumer to be in a failed state.
decaf::lang::ExceptiongetFailureError () 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.
long long getOptimizedAckScheduledAckInterval () const
 Time in Milliseconds before an automatic acknowledge is done for any outstanding delivered Messages.
void setOptimizedAckScheduledAckInterval (long long value)
 Sets the time in Milliseconds to schedule an automatic acknowledge of outstanding messages when optimize acknowledge is enabled.
bool isOptimizeAcknowledge () const
void setOptimizeAcknowledge (bool value)
 Enable or disable optimized acknowledge for this consumer.

Protected Member Functions

Pointer< MessageDispatchdequeue (long long timeout)
 Used by synchronous receive methods to wait for messages to come in.
void beforeMessageIsConsumed (Pointer< commands::MessageDispatch > dispatch)
 Pre-consume processing.
void afterMessageIsConsumed (Pointer< commands::MessageDispatch > dispatch, bool messageExpired)
 Post-consume processing.

Constructor & Destructor Documentation

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 activemq::core::kernels::ActiveMQConsumerKernel::~ActiveMQConsumerKernel (  )  [virtual]

Member Function Documentation

void activemq::core::kernels::ActiveMQConsumerKernel::acknowledge ( Pointer< commands::MessageDispatch dispatch,
int  ackType 
)

Method called to acknowledge the Message contained in the given MessageDispatch.

Exceptions:
CMSException if an error occurs while ack'ing the message.
void activemq::core::kernels::ActiveMQConsumerKernel::acknowledge ( Pointer< commands::MessageDispatch dispatch  ) 

Method called to acknowledge the Message contained in the given MessageDispatch.

Exceptions:
CMSException if an error occurs while ack'ing the message.
void activemq::core::kernels::ActiveMQConsumerKernel::acknowledge (  ) 

Method called to acknowledge all messages that have been received so far.

Exceptions:
CMSException if an error occurs while ack'ing the message.
void activemq::core::kernels::ActiveMQConsumerKernel::afterMessageIsConsumed ( Pointer< commands::MessageDispatch dispatch,
bool  messageExpired 
) [protected]

Post-consume processing.

Parameters:
dispatch - the consumed message
messageExpired - flag indicating if the message has expired.
void activemq::core::kernels::ActiveMQConsumerKernel::beforeMessageIsConsumed ( Pointer< commands::MessageDispatch dispatch  )  [protected]

Pre-consume processing.

Parameters:
dispatch - the message being consumed.
void activemq::core::kernels::ActiveMQConsumerKernel::clearMessagesInProgress (  ) 

Called on a Failover to clear any pending messages.

virtual void activemq::core::kernels::ActiveMQConsumerKernel::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.

void activemq::core::kernels::ActiveMQConsumerKernel::commit (  ) 

Called to Commit the current set of messages in this Transaction.

Exceptions:
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.

Exceptions:
ActiveMQException if an error occurs while performing the operation.
Pointer<MessageDispatch> activemq::core::kernels::ActiveMQConsumerKernel::dequeue ( long long  timeout  )  [protected]

Used by synchronous receive methods to wait for messages to come in.

Parameters:
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.

Returns:
the message, if received within the allotted time. Otherwise NULL.
Exceptions:
InvalidStateException if this consumer is closed upon entering this method.
virtual void activemq::core::kernels::ActiveMQConsumerKernel::dispatch ( const Pointer< MessageDispatch > &  message  )  [virtual]

Dispatches a message to a particular consumer.

Parameters:
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.

Exceptions:
ActiveMQException if an error occurs while performing the operation.
void activemq::core::kernels::ActiveMQConsumerKernel::doClose (  ) 

Performs the actual close operation on this consumer.

Exceptions:
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.

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

Get the Consumer information for this consumer.

Returns:
Reference to a Consumer Info Object
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.

Returns:
pointer to the error that faulted this Consumer or NULL.
virtual int activemq::core::kernels::ActiveMQConsumerKernel::getHashCode (  )  const [virtual]

HashCode method allowing Dispatcher instances to be used in HashMap etc.

Returns:
hash value for this Dispatcher.

Implements activemq::core::Dispatcher.

long long activemq::core::kernels::ActiveMQConsumerKernel::getLastDeliveredSequenceId (  )  const

Gets the currently set Last Delivered Sequence Id.

Returns:
long long containing the sequence id of the last delivered Message.
int activemq::core::kernels::ActiveMQConsumerKernel::getMessageAvailableCount (  )  const
Returns:
the number of Message's this consumer is waiting to Dispatch.
virtual cms::MessageAvailableListener* activemq::core::kernels::ActiveMQConsumerKernel::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::kernels::ActiveMQConsumerKernel::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::kernels::ActiveMQConsumerKernel::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::kernels::ActiveMQConsumerKernel::getMessageTransformer (  )  const [virtual]

Gets the currently configured MessageTransformer for this MessageConsumer.

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

Implements cms::MessageConsumer.

long long activemq::core::kernels::ActiveMQConsumerKernel::getOptimizedAckScheduledAckInterval (  )  const

Time in Milliseconds before an automatic acknowledge is done for any outstanding delivered Messages.

A value less than one means no task is scheduled.

Returns:
time in milliseconds for the scheduled ack task.
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.

Returns:
a Pointer to a RedeliveryPolicy that is in use by this Consumer.
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
Returns:
if this Consumer has been closed.
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.

Returns:
true if the consumer is subscribed to the given destination.
bool activemq::core::kernels::ActiveMQConsumerKernel::isOptimizeAcknowledge (  )  const
Returns:
true if this consumer is using optimize acknowledge mode.
bool activemq::core::kernels::ActiveMQConsumerKernel::isSynchronizationRegistered (  )  const

Has this Consumer Transaction Synchronization been added to the transaction.

Returns:
true if the synchronization has been added.
bool activemq::core::kernels::ActiveMQConsumerKernel::isTransactedIndividualAck (  )  const

Will Message's in a transaction be acknowledged using the Individual Acknowledge mode.

Returns:
true if individual transacted acknowledge is enabled.
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 cms::Message* activemq::core::kernels::ActiveMQConsumerKernel::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::kernels::ActiveMQConsumerKernel::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::kernels::ActiveMQConsumerKernel::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.

void activemq::core::kernels::ActiveMQConsumerKernel::rollback (  ) 

Called to Roll back the current set of messages in this Transaction.

Exceptions:
ActiveMQException if an error occurs while performing the operation.
void activemq::core::kernels::ActiveMQConsumerKernel::setFailoverRedeliveryWaitPeriod ( long long  value  ) 

Sets the time in milliseconds to delay after failover before starting message redelivery.

Parameters:
value Time in milliseconds to delay after failover for redelivery start.
long long activemq::core::kernels::ActiveMQConsumerKernel::setFailoverRedeliveryWaitPeriod (  )  const

Returns the delay after a failover before Message redelivery starts.

Returns:
time in milliseconds to wait after failover.
void activemq::core::kernels::ActiveMQConsumerKernel::setFailureError ( decaf::lang::Exception error  ) 

Sets the Exception that has caused this Consumer to be in a failed state.

Parameters:
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.

Parameters:
value The new value to assign to the Last Delivered Sequence Id property.
virtual void activemq::core::kernels::ActiveMQConsumerKernel::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:
listener The listener of new message events fired by this consumer.
Exceptions:
CMSException - If an internal error occurs.

Implements cms::MessageConsumer.

virtual void activemq::core::kernels::ActiveMQConsumerKernel::setMessageListener ( cms::MessageListener listener  )  [virtual]

Sets the MessageListener that this class will send notifs on.

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

Implements cms::MessageConsumer.

virtual void activemq::core::kernels::ActiveMQConsumerKernel::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:
transformer Pointer to the cms::MessageTransformer to apply on each cms:;Message dispatch.

Implements cms::MessageConsumer.

void activemq::core::kernels::ActiveMQConsumerKernel::setOptimizeAcknowledge ( bool  value  ) 

Enable or disable optimized acknowledge for this consumer.

Parameters:
value True if optimize acknowledge is enabled, false otherwise.
void activemq::core::kernels::ActiveMQConsumerKernel::setOptimizedAckScheduledAckInterval ( long long  value  ) 

Sets the time in Milliseconds to schedule an automatic acknowledge of outstanding messages when optimize acknowledge is enabled.

A value less than one means disable any scheduled tasks.

Parameters:
value The time interval to send scheduled acks.
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.

Parameters:
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.

Parameters:
value - true if registered false otherwise.
void activemq::core::kernels::ActiveMQConsumerKernel::setTransactedIndividualAck ( bool  value  ) 

Set if Message's in a transaction be acknowledged using the Individual Acknowledge mode.

Parameters:
value True if individual transacted acknowledge is enabled.
virtual void activemq::core::kernels::ActiveMQConsumerKernel::start (  )  [virtual]

Starts the service.

Exceptions:
CMSException if an internal error occurs while starting.

Implements cms::Startable.

virtual void activemq::core::kernels::ActiveMQConsumerKernel::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:

Generated on 1 Dec 2014 for activemq-cpp-3.8.2 by  doxygen 1.6.1