activemq-cpp-3.6.0
|
A pooled session object that wraps around a delegate session. More...
#include <src/main/activemq/cmsutil/PooledSession.h>
Public Member Functions | |
PooledSession (SessionPool *pool, cms::Session *session) | |
virtual | ~PooledSession () |
Does nothing. | |
virtual cms::Session * | getSession () |
Returns a non-constant reference to the internal session object. | |
virtual const cms::Session * | getSession () const |
Returns a constant reference to the internal session object. | |
virtual void | close () |
Returns this session back to the pool, but does not close or destroy the internal session object. | |
virtual void | start () |
Starts the service. | |
virtual void | stop () |
Stops this service. | |
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::MessageConsumer * | createConsumer (const cms::Destination *destination) |
Creates a MessageConsumer for the specified destination. | |
virtual cms::MessageConsumer * | createConsumer (const cms::Destination *destination, const std::string &selector) |
Creates a MessageConsumer for the specified destination, using a message selector. | |
virtual cms::MessageConsumer * | createConsumer (const cms::Destination *destination, const std::string &selector, bool noLocal) |
Creates a MessageConsumer for the specified destination, using a message selector. | |
virtual cms::MessageConsumer * | createDurableConsumer (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::MessageConsumer * | createCachedConsumer (const cms::Destination *destination, const std::string &selector, bool noLocal) |
First checks the internal consumer cache and creates on if none exist for the given destination, selector, noLocal. | |
virtual cms::MessageProducer * | createProducer (const cms::Destination *destination) |
Creates a MessageProducer to send messages to the specified destination. | |
virtual cms::MessageProducer * | createCachedProducer (const cms::Destination *destination) |
First checks the internal producer cache and creates one if none exist for the given destination. | |
virtual cms::QueueBrowser * | createBrowser (const cms::Queue *queue) |
Creates a new QueueBrowser to peek at Messages on the given Queue. | |
virtual cms::QueueBrowser * | createBrowser (const cms::Queue *queue, const std::string &selector) |
Creates a new QueueBrowser to peek at Messages on the given Queue. | |
virtual cms::Queue * | createQueue (const std::string &queueName) |
Creates a queue identity given a Queue name. | |
virtual cms::Topic * | createTopic (const std::string &topicName) |
Creates a topic identity given a Queue name. | |
virtual cms::TemporaryQueue * | createTemporaryQueue () |
Creates a TemporaryQueue object. | |
virtual cms::TemporaryTopic * | createTemporaryTopic () |
Creates a TemporaryTopic object. | |
virtual cms::Message * | createMessage () |
Creates a new Message. | |
virtual cms::BytesMessage * | createBytesMessage () |
Creates a BytesMessage. | |
virtual cms::BytesMessage * | createBytesMessage (const unsigned char *bytes, int bytesSize) |
Creates a BytesMessage and sets the payload to the passed value. | |
virtual cms::StreamMessage * | createStreamMessage () |
Creates a new StreamMessage. | |
virtual cms::TextMessage * | createTextMessage () |
Creates a new TextMessage. | |
virtual cms::TextMessage * | createTextMessage (const std::string &text) |
Creates a new TextMessage and set the text to the value given. | |
virtual cms::MapMessage * | createMapMessage () |
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. | |
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::MessageTransformer * | getMessageTransformer () const |
Gets the currently configured MessageTransformer for this Session. | |
![]() | |
virtual | ~Session () |
![]() | |
virtual | ~Closeable () |
![]() | |
virtual | ~Startable () |
![]() | |
virtual | ~Stoppable () |
Additional Inherited Members | |
![]() | |
enum | AcknowledgeMode { AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, SESSION_TRANSACTED, INDIVIDUAL_ACKNOWLEDGE } |
A pooled session object that wraps around a delegate session.
Calls to close this session only result in giving the session back to the pool.
activemq::cmsutil::PooledSession::PooledSession | ( | SessionPool * | pool, |
cms::Session * | session | ||
) |
|
virtual |
Does nothing.
|
virtual |
Returns this session back to the pool, but does not close or destroy the internal session object.
CMSException | if an error occurs while performing this operation. |
Implements cms::Session.
|
inlinevirtual |
Commits all messages done in this transaction and releases any locks currently held.
CMSException | - If an internal error occurs. |
IllegalStateException | - if the method is not called by a transacted session. |
Implements cms::Session.
References cms::Session::commit().
|
virtual |
Creates a new QueueBrowser to peek at Messages on the given Queue.
queue | the Queue to browse |
CMSException | - If an internal error occurs. |
InvalidDestinationException | - if the destination given is invalid. |
Implements cms::Session.
|
virtual |
Creates a new QueueBrowser to peek at Messages on the given Queue.
queue | the Queue to browse |
selector | the Message selector to filter which messages are browsed. |
CMSException | - If an internal error occurs. |
InvalidDestinationException | - if the destination given is invalid. |
Implements cms::Session.
|
inlinevirtual |
Creates a BytesMessage.
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createBytesMessage().
|
inlinevirtual |
Creates a BytesMessage and sets the payload to the passed value.
bytes | an array of bytes to set in the message |
bytesSize | the size of the bytes array, or number of bytes to use |
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createBytesMessage().
|
virtual |
First checks the internal consumer cache and creates on if none exist for the given destination, selector, noLocal.
If created, the consumer is added to the pool's lifecycle manager.
destination | the destination to receive on |
selector | the selector to use |
noLocal | whether or not to receive messages from the same connection |
cms::CMSException | if something goes wrong. |
|
virtual |
First checks the internal producer cache and creates one if none exist for the given destination.
If created, the producer is added to the pool's lifecycle manager.
destination | the destination to send on |
cms::CMSException | if something goes wrong. |
|
inlinevirtual |
Creates a MessageConsumer for the specified destination.
destination | the Destination that this consumer receiving messages for. |
CMSException | - If an internal error occurs. |
InvalidDestinationException | - if an invalid destination is specified. |
Implements cms::Session.
References cms::Session::createConsumer().
|
inlinevirtual |
Creates a MessageConsumer for the specified destination, using a message selector.
destination | the Destination that this consumer receiving messages for. |
selector | the Message Selector to use |
CMSException | - If an internal error occurs. |
InvalidDestinationException | - if an invalid destination is specified. |
InvalidSelectorException | - if the message selector is invalid. |
Implements cms::Session.
References cms::Session::createConsumer().
|
inlinevirtual |
Creates a MessageConsumer for the specified destination, using a message selector.
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. |
CMSException | - If an internal error occurs. |
InvalidDestinationException | - if an invalid destination is specified. |
InvalidSelectorException | - if the message selector is invalid. |
Implements cms::Session.
References cms::Session::createConsumer().
|
inlinevirtual |
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.
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. |
CMSException | - If an internal error occurs. |
InvalidDestinationException | - if an invalid destination is specified. |
InvalidSelectorException | - if the message selector is invalid. |
Implements cms::Session.
References cms::Session::createDurableConsumer().
|
inlinevirtual |
Creates a new MapMessage.
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createMapMessage().
|
inlinevirtual |
Creates a new Message.
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createMessage().
|
inlinevirtual |
Creates a MessageProducer to send messages to the specified destination.
destination | the Destination to send on |
CMSException | - If an internal error occurs. |
InvalidDestinationException | - if an invalid destination is specified. |
Implements cms::Session.
References cms::Session::createProducer().
|
inlinevirtual |
Creates a queue identity given a Queue name.
queueName | the name of the new Queue |
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createQueue().
|
inlinevirtual |
Creates a new StreamMessage.
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createStreamMessage().
|
inlinevirtual |
Creates a TemporaryQueue object.
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createTemporaryQueue().
|
inlinevirtual |
Creates a TemporaryTopic object.
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createTemporaryTopic().
|
inlinevirtual |
Creates a new TextMessage.
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createTextMessage().
|
inlinevirtual |
Creates a new TextMessage and set the text to the value given.
text | the initial text for the message |
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createTextMessage().
|
inlinevirtual |
Creates a topic identity given a Queue name.
topicName | the name of the new Topic |
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::createTopic().
|
inlinevirtual |
Returns the acknowledgment mode of the session.
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::getAcknowledgeMode().
|
inlinevirtual |
Gets the currently configured MessageTransformer for this Session.
Implements cms::Session.
References cms::Session::getMessageTransformer().
|
inlinevirtual |
Returns a non-constant reference to the internal session object.
|
inlinevirtual |
Returns a constant reference to the internal session object.
|
inlinevirtual |
Gets if the Sessions is a Transacted Session.
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::isTransacted().
|
inlinevirtual |
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:
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.
References cms::Session::recover().
|
inlinevirtual |
Rolls back all messages done in this transaction and releases any locks currently held.
CMSException | - If an internal error occurs. |
IllegalStateException | - if the method is not called by a transacted session. |
Implements cms::Session.
References cms::Session::rollback().
|
inlinevirtual |
Set an MessageTransformer instance that is passed on to all MessageProducer and MessageConsumer objects created from this Session.
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 set on all MessageConsumers and MessageProducers. |
Implements cms::Session.
References cms::Session::setMessageTransformer().
|
inlinevirtual |
Starts the service.
CMSException | if an internal error occurs while starting. |
Implements cms::Startable.
References cms::Startable::start().
|
inlinevirtual |
Stops this service.
CMSException | - if an internal error occurs while stopping the Service. |
Implements cms::Stoppable.
References cms::Stoppable::stop().
|
inlinevirtual |
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.
name | The name used to identify this subscription |
CMSException | - If an internal error occurs. |
Implements cms::Session.
References cms::Session::unsubscribe().