Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation

qpid::messaging::Session Class Reference
[Qpid C++ Client API]

A session represents a distinct 'conversation' which can involve sending and receiving messages to and from different addresses. More...

#include <qpid/messaging/Session.h>

List of all members.

Public Member Functions

 Session (SessionImpl *impl=0)
 Session (const Session &)
 ~Session ()
Sessionoperator= (const Session &)
void close ()
 Closes a session and all associated senders and receivers.
void commit ()
 Commits the sessions transaction.
void rollback ()
void acknowledge (bool sync=false)
 Acknowledges all outstanding messages that have been received by the application on this session.
void acknowledge (Message &, bool sync=false)
 Acknowledges the specified message.
void acknowledgeUpTo (Message &, bool sync=false)
 Acknowledges all message up to the specified message.
void reject (Message &)
 Rejects the specified message.
void release (Message &)
 Releases the specified message.
void sync (bool block=true)
 Request synchronisation with the server.
uint32_t getReceivable ()
 Returns the total number of messages received and waiting to be fetched by all Receivers belonging to this session.
uint32_t getUnsettledAcks ()
 Returns a count of the number of messages received this session that have been acknowledged, but for which that acknowledgement has not yet been confirmed as processed by the server.
bool nextReceiver (Receiver &, Duration timeout=Duration::FOREVER)
 Retrieves the receiver for the next available message.
Receiver nextReceiver (Duration timeout=Duration::FOREVER)
 Returns the receiver for the next available message.
Sender createSender (const Address &address)
 Create a new sender through which messages can be sent to the specified address.
Sender createSender (const std::string &address)
 Create a new sender through which messages can be sent to the specified address.
Receiver createReceiver (const Address &address)
 Create a new receiver through which messages can be received from the specified address.
Receiver createReceiver (const std::string &address)
 Create a new receiver through which messages can be received from the specified address.
Sender getSender (const std::string &name) const
 Returns the sender with the specified name.
Receiver getReceiver (const std::string &name) const
 Returns the receiver with the specified name.
Connection getConnection () const
 Returns a handle to the connection this session is associated with.
bool hasError ()
void checkError ()
 If the session has been rendered invalid by some exception, this method will result in that exception being thrown on calling this method.
QPID_MESSAGING_INLINE_EXTERN bool isValid () const
QPID_MESSAGING_INLINE_EXTERN bool isNull () const
QPID_MESSAGING_INLINE_EXTERN operator bool () const
 Conversion to bool supports idiom if (handle) { handle->.
QPID_MESSAGING_INLINE_EXTERN bool operator! () const
 Operator ! supports idiom if (!handle) { do_if_handle_is_null(); }.
void swap (Handle< SessionImpl > &h)

Protected Types

typedef SessionImpl Impl

Protected Attributes

Implimpl

Detailed Description

A session represents a distinct 'conversation' which can involve sending and receiving messages to and from different addresses.

Definition at line 49 of file Session.h.


Member Typedef Documentation

typedef SessionImpl qpid::messaging::Handle< SessionImpl >::Impl [protected, inherited]

Definition at line 62 of file Handle.h.


Constructor & Destructor Documentation

qpid::messaging::Session::Session ( SessionImpl *  impl = 0  ) 
qpid::messaging::Session::Session ( const Session  ) 
qpid::messaging::Session::~Session (  ) 

Member Function Documentation

void qpid::messaging::Session::acknowledge ( Message ,
bool  sync = false 
)

Acknowledges the specified message.

void qpid::messaging::Session::acknowledge ( bool  sync = false  ) 

Acknowledges all outstanding messages that have been received by the application on this session.

Parameters:
sync if true, blocks until the acknowledgement has been processed by the server
void qpid::messaging::Session::acknowledgeUpTo ( Message ,
bool  sync = false 
)

Acknowledges all message up to the specified message.

void qpid::messaging::Session::checkError (  ) 

If the session has been rendered invalid by some exception, this method will result in that exception being thrown on calling this method.

void qpid::messaging::Session::close (  ) 

Closes a session and all associated senders and receivers.

An opened session should be closed before the last handle to it goes out of scope. All a connections sessions can be closed by a call to Connection::close().

void qpid::messaging::Session::commit (  ) 

Commits the sessions transaction.

Exceptions:
TransactionAborted if the original session is lost forcing an automatic rollback.
Receiver qpid::messaging::Session::createReceiver ( const std::string &  address  ) 

Create a new receiver through which messages can be received from the specified address.

Exceptions:
ResolutionError if there is an error in resolving the address
MalformedAddress if the syntax of address is not valid
Receiver qpid::messaging::Session::createReceiver ( const Address address  ) 

Create a new receiver through which messages can be received from the specified address.

Exceptions:
ResolutionError if there is an error in resolving the address
Sender qpid::messaging::Session::createSender ( const std::string &  address  ) 

Create a new sender through which messages can be sent to the specified address.

Exceptions:
ResolutionError if there is an error in resolving the address
MalformedAddress if the syntax of address is not valid
Sender qpid::messaging::Session::createSender ( const Address address  ) 

Create a new sender through which messages can be sent to the specified address.

Exceptions:
ResolutionError if there is an error in resolving the address
Connection qpid::messaging::Session::getConnection (  )  const

Returns a handle to the connection this session is associated with.

uint32_t qpid::messaging::Session::getReceivable (  ) 

Returns the total number of messages received and waiting to be fetched by all Receivers belonging to this session.

This is the total number of available messages across all receivers on this session.

Receiver qpid::messaging::Session::getReceiver ( const std::string &  name  )  const

Returns the receiver with the specified name.

Exceptions:
KeyError if there is none for that name.
Sender qpid::messaging::Session::getSender ( const std::string &  name  )  const

Returns the sender with the specified name.

Exceptions:
KeyError if there is none for that name.
uint32_t qpid::messaging::Session::getUnsettledAcks (  ) 

Returns a count of the number of messages received this session that have been acknowledged, but for which that acknowledgement has not yet been confirmed as processed by the server.

bool qpid::messaging::Session::hasError (  ) 
Returns:
true if the session has been rendered invalid by some exception, false if it is valid for use.
QPID_MESSAGING_INLINE_EXTERN bool qpid::messaging::Handle< SessionImpl >::isNull (  )  const [inline, inherited]
Returns:
true if handle is null. It is an error to call any function on a null handle.

Definition at line 46 of file Handle.h.

References qpid::messaging::Handle< T >::impl.

QPID_MESSAGING_INLINE_EXTERN bool qpid::messaging::Handle< SessionImpl >::isValid (  )  const [inline, inherited]
Returns:
true if handle is valid, i.e. not null.

Definition at line 43 of file Handle.h.

References qpid::messaging::Handle< T >::impl.

Receiver qpid::messaging::Session::nextReceiver ( Duration  timeout = Duration::FOREVER  ) 

Returns the receiver for the next available message.

If there are no available messages at present the call will block for up to the specified timeout waiting for one to arrive.

Exceptions:
Receiver::NoMessageAvailable if no message became available in time.
bool qpid::messaging::Session::nextReceiver ( Receiver ,
Duration  timeout = Duration::FOREVER 
)

Retrieves the receiver for the next available message.

If there are no available messages at present the call will block for up to the specified timeout waiting for one to arrive. Returns true if a message was available at the point of return, in which case the passed in receiver reference will be set to the receiver for that message or false if no message was available.

QPID_MESSAGING_INLINE_EXTERN qpid::messaging::Handle< SessionImpl >::operator bool (  )  const [inline, inherited]

Conversion to bool supports idiom if (handle) { handle->.

.. }

Definition at line 49 of file Handle.h.

References qpid::messaging::Handle< T >::impl.

QPID_MESSAGING_INLINE_EXTERN bool qpid::messaging::Handle< SessionImpl >::operator! (  )  const [inline, inherited]

Operator ! supports idiom if (!handle) { do_if_handle_is_null(); }.

Definition at line 52 of file Handle.h.

References qpid::messaging::Handle< T >::impl.

Session& qpid::messaging::Session::operator= ( const Session  ) 
void qpid::messaging::Session::reject ( Message  ) 

Rejects the specified message.

The broker does not redeliver a message that has been rejected. Once a message has been acknowledged, it can no longer be rejected.

void qpid::messaging::Session::release ( Message  ) 

Releases the specified message.

The broker may redeliver the message. Once a message has been acknowledged, it can no longer be released.

void qpid::messaging::Session::rollback (  ) 
void qpid::messaging::Handle< SessionImpl >::swap ( Handle< SessionImpl > &  h  )  [inline, inherited]

Definition at line 54 of file Handle.h.

References qpid::messaging::Handle< T >::impl.

void qpid::messaging::Session::sync ( bool  block = true  ) 

Request synchronisation with the server.

Parameters:
block if true, this call will block until the server confirms completion of all pending operations; if false the call will request notification from the server but will return before receiving it.

Member Data Documentation

Impl* qpid::messaging::Handle< SessionImpl >::impl [protected, inherited]

Definition at line 65 of file Handle.h.


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

Qpid C++ API Reference
Generated on 8 Jul 2014 for Qpid C++ Client API by doxygen 1.6.1