activemq::core::kernels::ActiveMQSessionKernel Class Reference

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

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

Public Member Functions

 ActiveMQSessionKernel (ActiveMQConnection *connection, const Pointer< commands::SessionId > &id, cms::Session::AcknowledgeMode ackMode, const decaf::util::Properties &properties)
virtual ~ActiveMQSessionKernel ()
virtual void redispatch (MessageDispatchChannel &unconsumedMessages)
 Redispatches the given set of unconsumed messages to the consumers.
virtual void start ()
 Stops asynchronous message delivery.
virtual void stop ()
 Starts asynchronous message delivery.
bool isStarted () const
 Indicates whether or not the session is currently in the started state.
virtual bool isAutoAcknowledge () const
virtual bool isDupsOkAcknowledge () const
virtual bool isClientAcknowledge () const
virtual bool isIndividualAcknowledge () const
void fire (const exceptions::ActiveMQException &ex)
 Fires the given exception to the exception listener of the connection.
virtual void dispatch (const Pointer< MessageDispatch > &message)
 Dispatches a message to a particular consumer.
virtual void close ()
 Closes this session as well as any active child consumers or producers.
virtual void commit ()
 Commits all messages done in this transaction and releases any locks currently held.
virtual void rollback ()
 Rolls back all messages done in this transaction and releases any locks currently held.
virtual void recover ()
 Stops message delivery in this session, and restarts message delivery with the oldest unacknowledged message.
virtual cms::MessageConsumercreateConsumer (const cms::Destination *destination)
 Creates a MessageConsumer for the specified destination.
virtual cms::MessageConsumercreateConsumer (const cms::Destination *destination, const std::string &selector)
 Creates a MessageConsumer for the specified destination, using a message selector.
virtual cms::MessageConsumercreateConsumer (const cms::Destination *destination, const std::string &selector, bool noLocal)
 Creates a MessageConsumer for the specified destination, using a message selector.
virtual cms::MessageConsumercreateDurableConsumer (const cms::Topic *destination, const std::string &name, const std::string &selector, bool noLocal=false)
 Creates a durable subscriber to the specified topic, using a Message selector.
virtual cms::MessageProducercreateProducer (const cms::Destination *destination)
 Creates a MessageProducer to send messages to the specified destination.
virtual cms::QueueBrowsercreateBrowser (const cms::Queue *queue)
 Creates a new QueueBrowser to peek at Messages on the given Queue.
virtual cms::QueueBrowsercreateBrowser (const cms::Queue *queue, const std::string &selector)
 Creates a new QueueBrowser to peek at Messages on the given Queue.
virtual cms::QueuecreateQueue (const std::string &queueName)
 Creates a queue identity given a Queue name.
virtual cms::TopiccreateTopic (const std::string &topicName)
 Creates a topic identity given a Queue name.
virtual cms::TemporaryQueuecreateTemporaryQueue ()
 Creates a TemporaryQueue object.
virtual cms::TemporaryTopiccreateTemporaryTopic ()
 Creates a TemporaryTopic object.
virtual cms::MessagecreateMessage ()
 Creates a new Message.
virtual cms::BytesMessagecreateBytesMessage ()
 Creates a BytesMessage.
virtual cms::BytesMessagecreateBytesMessage (const unsigned char *bytes, int bytesSize)
 Creates a BytesMessage and sets the payload to the passed value.
virtual cms::StreamMessagecreateStreamMessage ()
 Creates a new StreamMessage.
virtual cms::TextMessagecreateTextMessage ()
 Creates a new TextMessage.
virtual cms::TextMessagecreateTextMessage (const std::string &text)
 Creates a new TextMessage and set the text to the value given.
virtual cms::MapMessagecreateMapMessage ()
 Creates a new MapMessage.
virtual
cms::Session::AcknowledgeMode 
getAcknowledgeMode () const
 Returns the acknowledgment mode of the session.
virtual bool isTransacted () const
 Gets if the Sessions is a Transacted Session.
virtual void unsubscribe (const std::string &name)
 Unsubscribes a durable subscription that has been created by a client.
void send (kernels::ActiveMQProducerKernel *producer, Pointer< commands::ActiveMQDestination > destination, cms::Message *message, int deliveryMode, int priority, long long timeToLive, util::MemoryUsage *producerWindow, long long sendTimeout, cms::AsyncCallback *onComplete)
 Sends a message from the Producer specified using this session's connection the message will be sent using the best available means depending on the configuration of the connection.
cms::ExceptionListenergetExceptionListener ()
 This method gets any registered exception listener of this sessions connection and returns it.
virtual void setMessageTransformer (cms::MessageTransformer *transformer)
 Set an MessageTransformer instance that is passed on to all MessageProducer and MessageConsumer objects created from this Session.
virtual cms::MessageTransformergetMessageTransformer () const
 Gets the currently configured MessageTransformer for this Session.
const commands::SessionInfogetSessionInfo () const
 Gets the Session Information object for this session, if the session is closed than this method throws an exception.
const commands::SessionIdgetSessionId () const
 Gets the Session Id object for this session, if the session is closed than this method throws an exception.
ActiveMQConnectiongetConnection () const
 Gets the ActiveMQConnection that is associated with this session.
Pointer< threads::SchedulergetScheduler () const
 Gets a Pointer to this Session's Scheduler instance.
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.
void oneway (Pointer< commands::Command > command)
 Sends a Command to the broker without requesting any Response be returned.
Pointer< commands::ResponsesyncRequest (Pointer< commands::Command > command, unsigned int timeout=0)
 Sends a synchronous request and returns the response from the broker.
void addConsumer (Pointer< ActiveMQConsumerKernel > consumer)
 Adds a MessageConsumerKernel to this session registering it with the Connection and store a reference to it so the session can ensure that all resources are closed when the session is closed.
void removeConsumer (Pointer< ActiveMQConsumerKernel > consumer)
 Dispose of a MessageConsumer from this session.
void addProducer (Pointer< ActiveMQProducerKernel > producer)
 Adds a MessageProducer to this session registering it with the Connection and store a reference to it so the session can ensure that all resources are closed when the session is closed.
void removeProducer (Pointer< ActiveMQProducerKernel > producer)
 Dispose of a MessageProducer from this session.
virtual void doStartTransaction ()
 Starts if not already start a Transaction for this Session.
Pointer
< ActiveMQTransactionContext
getTransactionContext ()
 Gets the Pointer to this Session's TransactionContext.
void acknowledge ()
 Request that the Session inform all its consumers to Acknowledge all Message's that have been received so far.
void deliverAcks ()
 Request that this Session inform all of its consumers to deliver their pending acks.
void clearMessagesInProgress ()
 Request that this Session inform all of its consumers to clear all messages that are currently in progress.
void wakeup ()
 Causes the Session to wakeup its executer and ensure all messages are dispatched.
Pointer< commands::ConsumerIdgetNextConsumerId ()
 Get the Next available Consumer Id.
Pointer< commands::ProducerIdgetNextProducerId ()
 Get the Next available Producer Id.
void doClose ()
 Performs the actual Session close operations.
void dispose ()
 Cleans up the Session object's resources without attempting to send the Remove command to the broker, this can be called from ActiveMQConnection when it knows that the transport is down and the doClose method would throw an exception when it attempt to send the Remove Command.
void setPrefetchSize (Pointer< commands::ConsumerId > id, int prefetch)
 Set the prefetch level for the given consumer if it exists in this Session to the value specified.
void close (Pointer< commands::ConsumerId > id)
 Close the specified consumer if present in this Session.
bool isInUse (Pointer< commands::ActiveMQDestination > destination)
 Checks if the given destination is currently in use by any consumers in this Session.
Pointer< ActiveMQProducerKernellookupProducerKernel (Pointer< commands::ProducerId > id)
Pointer< ActiveMQConsumerKernellookupConsumerKernel (Pointer< commands::ConsumerId > id)
bool iterateConsumers ()
 Gives each consumer a chance to dispatch messages that have been enqueued by calling each consumers iterate method.
void checkMessageListener () const
 Checks if any MessageConsumer owned by this Session has a set MessageListener and throws an exception if so.
virtual int getHashCode () const
 Returns a Hash Code for this Session based on its SessionId.
void sendAck (decaf::lang::Pointer< commands::MessageAck > ack, bool async=false)
 Sends the given MessageAck command to the Broker either via Synchronous call or an Asynchronous call depending on the value of the async parameter.

Protected Attributes

SessionConfig * config
Pointer< commands::SessionInfosessionInfo
 SessionInfo for this Session.
Pointer
< ActiveMQTransactionContext
transaction
 Transaction Management object.
ActiveMQConnectionconnection
 Connection.
AtomicBoolean closed
 Indicates that this connection has been closed, it is no longer usable after this becomes true.
std::auto_ptr
< ActiveMQSessionExecutor
executor
 Sends incoming messages to the registered consumers.
cms::Session::AcknowledgeMode ackMode
 This Sessions Acknowledgment mode.
util::LongSequenceGenerator producerIds
 Next available Producer Id.
util::LongSequenceGenerator producerSequenceIds
 Next available Producer Sequence Id.
util::LongSequenceGenerator consumerIds
 Next available Consumer Id.
long long lastDeliveredSequenceId
 Last Delivered Sequence Id.

Friends

class activemq::core::ActiveMQSessionExecutor

Constructor & Destructor Documentation

activemq::core::kernels::ActiveMQSessionKernel::ActiveMQSessionKernel ( ActiveMQConnection connection,
const Pointer< commands::SessionId > &  id,
cms::Session::AcknowledgeMode  ackMode,
const decaf::util::Properties properties 
)
virtual activemq::core::kernels::ActiveMQSessionKernel::~ActiveMQSessionKernel (  )  [virtual]

Member Function Documentation

void activemq::core::kernels::ActiveMQSessionKernel::acknowledge (  ) 

Request that the Session inform all its consumers to Acknowledge all Message's that have been received so far.

void activemq::core::kernels::ActiveMQSessionKernel::addConsumer ( Pointer< ActiveMQConsumerKernel consumer  ) 

Adds a MessageConsumerKernel to this session registering it with the Connection and store a reference to it so the session can ensure that all resources are closed when the session is closed.

Parameters:
consumer The ActiveMQConsumerKernel instance to add to this session.
Exceptions:
ActiveMQException if an internal error occurs.
void activemq::core::kernels::ActiveMQSessionKernel::addProducer ( Pointer< ActiveMQProducerKernel producer  ) 

Adds a MessageProducer to this session registering it with the Connection and store a reference to it so the session can ensure that all resources are closed when the session is closed.

Parameters:
producer The ActiveMQProducerKernel instance to add to this session.
Exceptions:
ActiveMQException if an internal error occurs.
void activemq::core::kernels::ActiveMQSessionKernel::checkMessageListener (  )  const

Checks if any MessageConsumer owned by this Session has a set MessageListener and throws an exception if so.

This enforces the rule that the MessageConsumers belonging to a Session either operate in sync or async receive as a group.

void activemq::core::kernels::ActiveMQSessionKernel::clearMessagesInProgress (  ) 

Request that this Session inform all of its consumers to clear all messages that are currently in progress.

void activemq::core::kernels::ActiveMQSessionKernel::close ( Pointer< commands::ConsumerId id  ) 

Close the specified consumer if present in this Session.

Parameters:
id The consumer Id to close.
virtual void activemq::core::kernels::ActiveMQSessionKernel::close (  )  [virtual]

Closes this session as well as any active child consumers or producers.

Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual void activemq::core::kernels::ActiveMQSessionKernel::commit (  )  [virtual]

Commits all messages done in this transaction and releases any locks currently held.

Exceptions:
CMSException - If an internal error occurs.
IllegalStateException - if the method is not called by a transacted session.

Implements cms::Session.

Reimplemented in activemq::core::kernels::ActiveMQXASessionKernel.

virtual cms::QueueBrowser* activemq::core::kernels::ActiveMQSessionKernel::createBrowser ( const cms::Queue queue,
const std::string &  selector 
) [virtual]

Creates a new QueueBrowser to peek at Messages on the given Queue.

Parameters:
queue the Queue to browse
selector the Message selector to filter which messages are browsed.
Returns:
New QueueBrowser that is owned by the caller.
Exceptions:
CMSException - If an internal error occurs.
InvalidDestinationException - if the destination given is invalid.

Implements cms::Session.

virtual cms::QueueBrowser* activemq::core::kernels::ActiveMQSessionKernel::createBrowser ( const cms::Queue queue  )  [virtual]

Creates a new QueueBrowser to peek at Messages on the given Queue.

Parameters:
queue the Queue to browse
Returns:
New QueueBrowser that is owned by the caller.
Exceptions:
CMSException - If an internal error occurs.
InvalidDestinationException - if the destination given is invalid.

Implements cms::Session.

virtual cms::BytesMessage* activemq::core::kernels::ActiveMQSessionKernel::createBytesMessage ( const unsigned char *  bytes,
int  bytesSize 
) [virtual]

Creates a BytesMessage and sets the payload to the passed value.

Parameters:
bytes an array of bytes to set in the message
bytesSize the size of the bytes array, or number of bytes to use
Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual cms::BytesMessage* activemq::core::kernels::ActiveMQSessionKernel::createBytesMessage (  )  [virtual]

Creates a BytesMessage.

Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual cms::MessageConsumer* activemq::core::kernels::ActiveMQSessionKernel::createConsumer ( const cms::Destination destination,
const std::string &  selector,
bool  noLocal 
) [virtual]

Creates a MessageConsumer for the specified destination, using a message selector.

Parameters:
destination the Destination that this consumer receiving messages for.
selector the Message Selector to use
noLocal if true, and the destination is a topic, inhibits the delivery of messages published by its own connection. The behavior for NoLocal is not specified if the destination is a queue.
Returns:
pointer to a new MessageConsumer that is owned by the caller ( caller deletes )
Exceptions:
CMSException - If an internal error occurs.
InvalidDestinationException - if an invalid destination is specified.
InvalidSelectorException - if the message selector is invalid.

Implements cms::Session.

virtual cms::MessageConsumer* activemq::core::kernels::ActiveMQSessionKernel::createConsumer ( const cms::Destination destination,
const std::string &  selector 
) [virtual]

Creates a MessageConsumer for the specified destination, using a message selector.

Parameters:
destination the Destination that this consumer receiving messages for.
selector the Message Selector to use
Returns:
pointer to a new MessageConsumer that is owned by the caller ( caller deletes )
Exceptions:
CMSException - If an internal error occurs.
InvalidDestinationException - if an invalid destination is specified.
InvalidSelectorException - if the message selector is invalid.

Implements cms::Session.

virtual cms::MessageConsumer* activemq::core::kernels::ActiveMQSessionKernel::createConsumer ( const cms::Destination destination  )  [virtual]

Creates a MessageConsumer for the specified destination.

Parameters:
destination the Destination that this consumer receiving messages for.
Returns:
pointer to a new MessageConsumer that is owned by the caller ( caller deletes )
Exceptions:
CMSException - If an internal error occurs.
InvalidDestinationException - if an invalid destination is specified.

Implements cms::Session.

virtual cms::MessageConsumer* activemq::core::kernels::ActiveMQSessionKernel::createDurableConsumer ( const cms::Topic destination,
const std::string &  name,
const std::string &  selector,
bool  noLocal = false 
) [virtual]

Creates a durable subscriber to the specified topic, using a Message selector.

Sessions that create durable consumers must use the same client Id as was used the last time the subscription was created in order to receive all messages that were delivered while the client was offline.

Parameters:
destination the topic to subscribe to
name The name used to identify the subscription
selector the Message Selector to use
noLocal if true, and the destination is a topic, inhibits the delivery of messages published by its own connection. The behavior for NoLocal is not specified if the destination is a queue.
Returns:
pointer to a new durable MessageConsumer that is owned by the caller ( caller deletes )
Exceptions:
CMSException - If an internal error occurs.
InvalidDestinationException - if an invalid destination is specified.
InvalidSelectorException - if the message selector is invalid.

Implements cms::Session.

virtual cms::MapMessage* activemq::core::kernels::ActiveMQSessionKernel::createMapMessage (  )  [virtual]

Creates a new MapMessage.

Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual cms::Message* activemq::core::kernels::ActiveMQSessionKernel::createMessage (  )  [virtual]

Creates a new Message.

Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual cms::MessageProducer* activemq::core::kernels::ActiveMQSessionKernel::createProducer ( const cms::Destination destination  )  [virtual]

Creates a MessageProducer to send messages to the specified destination.

Parameters:
destination the Destination to send on
Returns:
New MessageProducer that is owned by the caller.
Exceptions:
CMSException - If an internal error occurs.
InvalidDestinationException - if an invalid destination is specified.

Implements cms::Session.

virtual cms::Queue* activemq::core::kernels::ActiveMQSessionKernel::createQueue ( const std::string &  queueName  )  [virtual]

Creates a queue identity given a Queue name.

Parameters:
queueName the name of the new Queue
Returns:
new Queue pointer that is owned by the caller.
Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual cms::StreamMessage* activemq::core::kernels::ActiveMQSessionKernel::createStreamMessage (  )  [virtual]

Creates a new StreamMessage.

Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual cms::TemporaryQueue* activemq::core::kernels::ActiveMQSessionKernel::createTemporaryQueue (  )  [virtual]

Creates a TemporaryQueue object.

Returns:
new TemporaryQueue pointer that is owned by the caller.
Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual cms::TemporaryTopic* activemq::core::kernels::ActiveMQSessionKernel::createTemporaryTopic (  )  [virtual]

Creates a TemporaryTopic object.

Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual cms::TextMessage* activemq::core::kernels::ActiveMQSessionKernel::createTextMessage ( const std::string &  text  )  [virtual]

Creates a new TextMessage and set the text to the value given.

Parameters:
text the initial text for the message
Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual cms::TextMessage* activemq::core::kernels::ActiveMQSessionKernel::createTextMessage (  )  [virtual]

Creates a new TextMessage.

Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

virtual cms::Topic* activemq::core::kernels::ActiveMQSessionKernel::createTopic ( const std::string &  topicName  )  [virtual]

Creates a topic identity given a Queue name.

Parameters:
topicName the name of the new Topic
Returns:
new Topic pointer that is owned by the caller.
Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

void activemq::core::kernels::ActiveMQSessionKernel::deliverAcks (  ) 

Request that this Session inform all of its consumers to deliver their pending acks.

virtual void activemq::core::kernels::ActiveMQSessionKernel::dispatch ( const Pointer< MessageDispatch > &  message  )  [virtual]

Dispatches a message to a particular consumer.

Parameters:
message - the message to be dispatched

Implements activemq::core::Dispatcher.

void activemq::core::kernels::ActiveMQSessionKernel::dispose (  ) 

Cleans up the Session object's resources without attempting to send the Remove command to the broker, this can be called from ActiveMQConnection when it knows that the transport is down and the doClose method would throw an exception when it attempt to send the Remove Command.

void activemq::core::kernels::ActiveMQSessionKernel::doClose (  ) 

Performs the actual Session close operations.

This method is meant for use by ActiveMQConnection, the connection object calls this when it has been closed to skip some of the extraneous processing done by the client level close method.

virtual void activemq::core::kernels::ActiveMQSessionKernel::doStartTransaction (  )  [virtual]

Starts if not already start a Transaction for this Session.

If the session is not a Transacted Session then an exception is thrown. If a transaction is already in progress then this method has no effect.

Exceptions:
ActiveMQException if this is not a Transacted Session.

Reimplemented in activemq::core::kernels::ActiveMQXASessionKernel.

void activemq::core::kernels::ActiveMQSessionKernel::fire ( const exceptions::ActiveMQException ex  ) 

Fires the given exception to the exception listener of the connection.

virtual cms::Session::AcknowledgeMode activemq::core::kernels::ActiveMQSessionKernel::getAcknowledgeMode (  )  const [virtual]

Returns the acknowledgment mode of the session.

Returns:
the Sessions Acknowledge Mode
Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

ActiveMQConnection* activemq::core::kernels::ActiveMQSessionKernel::getConnection (  )  const [inline]

Gets the ActiveMQConnection that is associated with this session.

cms::ExceptionListener* activemq::core::kernels::ActiveMQSessionKernel::getExceptionListener (  ) 

This method gets any registered exception listener of this sessions connection and returns it.

Mainly intended for use by the objects that this session creates so that they can notify the client of exceptions that occur in the context of another thread.

Returns:
the registered cms::ExceptionListener pointer or NULL
virtual int activemq::core::kernels::ActiveMQSessionKernel::getHashCode (  )  const [virtual]

Returns a Hash Code for this Session based on its SessionId.

Returns:
an int hash code based on the string balue of SessionId.

Implements activemq::core::Dispatcher.

long long activemq::core::kernels::ActiveMQSessionKernel::getLastDeliveredSequenceId (  )  const [inline]

Gets the currently set Last Delivered Sequence Id.

Returns:
long long containing the sequence id of the last delivered Message.
virtual cms::MessageTransformer* activemq::core::kernels::ActiveMQSessionKernel::getMessageTransformer (  )  const [virtual]

Gets the currently configured MessageTransformer for this Session.

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

Implements cms::Session.

Pointer<commands::ConsumerId> activemq::core::kernels::ActiveMQSessionKernel::getNextConsumerId (  ) 

Get the Next available Consumer Id.

Returns:
the next id in the sequence.
Pointer<commands::ProducerId> activemq::core::kernels::ActiveMQSessionKernel::getNextProducerId (  ) 

Get the Next available Producer Id.

Returns:
the next id in the sequence.
Pointer<threads::Scheduler> activemq::core::kernels::ActiveMQSessionKernel::getScheduler (  )  const

Gets a Pointer to this Session's Scheduler instance.

const commands::SessionId& activemq::core::kernels::ActiveMQSessionKernel::getSessionId (  )  const [inline]

Gets the Session Id object for this session, if the session is closed than this method throws an exception.

Returns:
SessionId Reference
const commands::SessionInfo& activemq::core::kernels::ActiveMQSessionKernel::getSessionInfo (  )  const [inline]

Gets the Session Information object for this session, if the session is closed than this method throws an exception.

Returns:
SessionInfo Reference
Pointer<ActiveMQTransactionContext> activemq::core::kernels::ActiveMQSessionKernel::getTransactionContext (  )  [inline]

Gets the Pointer to this Session's TransactionContext.

Returns:
a Pointer to this Session's TransactionContext
virtual bool activemq::core::kernels::ActiveMQSessionKernel::isAutoAcknowledge (  )  const [inline, virtual]
virtual bool activemq::core::kernels::ActiveMQSessionKernel::isClientAcknowledge (  )  const [inline, virtual]
virtual bool activemq::core::kernels::ActiveMQSessionKernel::isDupsOkAcknowledge (  )  const [inline, virtual]
virtual bool activemq::core::kernels::ActiveMQSessionKernel::isIndividualAcknowledge (  )  const [inline, virtual]
bool activemq::core::kernels::ActiveMQSessionKernel::isInUse ( Pointer< commands::ActiveMQDestination destination  ) 

Checks if the given destination is currently in use by any consumers in this Session.

Returns:
true if there is a consumer of this destination in this Session.
bool activemq::core::kernels::ActiveMQSessionKernel::isStarted (  )  const

Indicates whether or not the session is currently in the started state.

virtual bool activemq::core::kernels::ActiveMQSessionKernel::isTransacted (  )  const [virtual]

Gets if the Sessions is a Transacted Session.

Returns:
transacted true - false.
Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

Reimplemented in activemq::core::kernels::ActiveMQXASessionKernel.

bool activemq::core::kernels::ActiveMQSessionKernel::iterateConsumers (  ) 

Gives each consumer a chance to dispatch messages that have been enqueued by calling each consumers iterate method.

Returns true if this method needs to be called again because a consumer requires further processing time to complete its dispatching. Once all consumers are done this method returns false.

Returns:
true if more iterations are needed false otherwise.
Pointer<ActiveMQConsumerKernel> activemq::core::kernels::ActiveMQSessionKernel::lookupConsumerKernel ( Pointer< commands::ConsumerId id  ) 
Returns:
a Pointer to an ActiveMQConsumerKernel using its ConsumerId, or NULL.
Pointer<ActiveMQProducerKernel> activemq::core::kernels::ActiveMQSessionKernel::lookupProducerKernel ( Pointer< commands::ProducerId id  ) 
Returns:
a Pointer to an ActiveMQProducerKernel using its ProducerId, or NULL.
void activemq::core::kernels::ActiveMQSessionKernel::oneway ( Pointer< commands::Command command  ) 

Sends a Command to the broker without requesting any Response be returned.

Parameters:
command The message to send to the Broker.
Exceptions:
ActiveMQException if not currently connected, or if the operation fails for any reason.
virtual void activemq::core::kernels::ActiveMQSessionKernel::recover (  )  [virtual]

Stops message delivery in this session, and restarts message delivery with the oldest unacknowledged message.

All consumers deliver messages in a serial order. Acknowledging a received message automatically acknowledges all messages that have been delivered to the client.

Restarting a session causes it to take the following actions:

  • Stop message delivery
  • Mark all messages that might have been delivered but not acknowledged as "redelivered"
  • Restart the delivery sequence including all unacknowledged messages that had been previously delivered. Redelivered messages do not have to be delivered in exactly their original delivery order.
Exceptions:
CMSException - if the CMS provider fails to stop and restart message delivery due to some internal error.
IllegalStateException - if the method is called by a transacted session.

Implements cms::Session.

virtual void activemq::core::kernels::ActiveMQSessionKernel::redispatch ( MessageDispatchChannel unconsumedMessages  )  [virtual]

Redispatches the given set of unconsumed messages to the consumers.

Parameters:
unconsumedMessages - unconsumed messages to be redelivered.
void activemq::core::kernels::ActiveMQSessionKernel::removeConsumer ( Pointer< ActiveMQConsumerKernel consumer  ) 

Dispose of a MessageConsumer from this session.

Removes it from the Connection and clean up any resources associated with it.

Parameters:
consumer The ActiveMQConsumerKernel instance to remove from this session.
Exceptions:
ActiveMQException if an internal error occurs.
void activemq::core::kernels::ActiveMQSessionKernel::removeProducer ( Pointer< ActiveMQProducerKernel producer  ) 

Dispose of a MessageProducer from this session.

Removes it from the Connection and clean up any resources associated with it.

Parameters:
producer The Producer kernel instance to remove from this session.
Exceptions:
ActiveMQException if an internal error occurs.
virtual void activemq::core::kernels::ActiveMQSessionKernel::rollback (  )  [virtual]

Rolls back all messages done in this transaction and releases any locks currently held.

Exceptions:
CMSException - If an internal error occurs.
IllegalStateException - if the method is not called by a transacted session.

Implements cms::Session.

Reimplemented in activemq::core::kernels::ActiveMQXASessionKernel.

void activemq::core::kernels::ActiveMQSessionKernel::send ( kernels::ActiveMQProducerKernel producer,
Pointer< commands::ActiveMQDestination destination,
cms::Message message,
int  deliveryMode,
int  priority,
long long  timeToLive,
util::MemoryUsage producerWindow,
long long  sendTimeout,
cms::AsyncCallback onComplete 
)

Sends a message from the Producer specified using this session's connection the message will be sent using the best available means depending on the configuration of the connection.

Asynchronous sends will be chosen if at all possible.

Parameters:
producer The sending Producer
destination The target destination for the Message.
message The message to send to the broker.
deliveryMode The delivery mode to assign to the outgoing message.
priority The priority value to assign to the outgoing message.
timeToLive The time to live for the outgoing message.
usage Pointer to a Usage tracker which if set will be increased by the size of the given message.
sendTimeout The amount of time to block during send before failing, or 0 to wait forever.
Exceptions:
CMSException if an error occurs while sending the message.
void activemq::core::kernels::ActiveMQSessionKernel::sendAck ( decaf::lang::Pointer< commands::MessageAck ack,
bool  async = false 
)

Sends the given MessageAck command to the Broker either via Synchronous call or an Asynchronous call depending on the value of the async parameter.

Parameters:
ack The MessageAck command to send.
async True if the command can be sent asynchronously.
void activemq::core::kernels::ActiveMQSessionKernel::setLastDeliveredSequenceId ( long long  value  )  [inline]

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::ActiveMQSessionKernel::setMessageTransformer ( cms::MessageTransformer transformer  )  [virtual]

Set an MessageTransformer instance that is passed on to all MessageProducer and MessageConsumer objects created from this Session.

Parameters:
transformer Pointer to the cms::MessageTransformer to set on all MessageConsumers and MessageProducers.

Implements cms::Session.

void activemq::core::kernels::ActiveMQSessionKernel::setPrefetchSize ( Pointer< commands::ConsumerId id,
int  prefetch 
)

Set the prefetch level for the given consumer if it exists in this Session to the value specified.

Parameters:
id The consumer Id to search for and set prefetch level.
prefetch The new prefetch value.
virtual void activemq::core::kernels::ActiveMQSessionKernel::start (  )  [virtual]

Stops asynchronous message delivery.

Implements cms::Startable.

virtual void activemq::core::kernels::ActiveMQSessionKernel::stop (  )  [virtual]

Starts asynchronous message delivery.

Implements cms::Stoppable.

Pointer<commands::Response> activemq::core::kernels::ActiveMQSessionKernel::syncRequest ( Pointer< commands::Command command,
unsigned int  timeout = 0 
)

Sends a synchronous request and returns the response from the broker.

Converts any error responses into an exception.

Parameters:
command The command to send to the broker.
timeout The time to wait for a response, default is zero or infinite.
Returns:
Pointer to a Response object that the broker has returned for the Command sent.
Exceptions:
ActiveMQException thrown if an error response was received from the broker, or if any other error occurred.
virtual void activemq::core::kernels::ActiveMQSessionKernel::unsubscribe ( const std::string &  name  )  [virtual]

Unsubscribes a durable subscription that has been created by a client.

This method deletes the state being maintained on behalf of the subscriber by its provider. It is erroneous for a client to delete a durable subscription while there is an active MessageConsumer or Subscriber for the subscription, or while a consumed message is part of a pending transaction or has not been acknowledged in the session.

Parameters:
name The name used to identify this subscription
Exceptions:
CMSException - If an internal error occurs.

Implements cms::Session.

void activemq::core::kernels::ActiveMQSessionKernel::wakeup (  ) 

Causes the Session to wakeup its executer and ensure all messages are dispatched.


Friends And Related Function Documentation


Field Documentation

This Sessions Acknowledgment mode.

Indicates that this connection has been closed, it is no longer usable after this becomes true.

Connection.

Next available Consumer Id.

Sends incoming messages to the registered consumers.

Last Delivered Sequence Id.

Next available Producer Id.

Next available Producer Sequence Id.

SessionInfo for this Session.

Transaction Management object.


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