Qpid C++ Messaging API  1.39.0
qpid::messaging::Session Class Reference

#include <Session.h>

Inheritance diagram for qpid::messaging::Session:
qpid::messaging::Handle< SessionImpl >

Public Member Functions

QPID_MESSAGING_EXTERN Session (SessionImpl *impl=0)
 
QPID_MESSAGING_EXTERN Session (const Session &)
 
QPID_MESSAGING_EXTERN Sessionoperator= (const Session &)
 
QPID_MESSAGING_EXTERN void close ()
 
QPID_MESSAGING_EXTERN void commit ()
 
QPID_MESSAGING_EXTERN void rollback ()
 
QPID_MESSAGING_EXTERN void acknowledge (bool sync=false)
 
QPID_MESSAGING_EXTERN void acknowledge (Message &, bool sync=false)
 
QPID_MESSAGING_EXTERN void acknowledgeUpTo (Message &, bool sync=false)
 
QPID_MESSAGING_EXTERN void reject (Message &)
 
QPID_MESSAGING_EXTERN void release (Message &)
 
QPID_MESSAGING_EXTERN void sync (bool block=true)
 
QPID_MESSAGING_EXTERN uint32_t getReceivable ()
 
QPID_MESSAGING_EXTERN uint32_t getUnsettledAcks ()
 
QPID_MESSAGING_EXTERN bool nextReceiver (Receiver &, Duration timeout=Duration::FOREVER)
 
QPID_MESSAGING_EXTERN Receiver nextReceiver (Duration timeout=Duration::FOREVER)
 
QPID_MESSAGING_EXTERN Sender createSender (const Address &address)
 
QPID_MESSAGING_EXTERN Sender createSender (const std::string &address)
 
QPID_MESSAGING_EXTERN Receiver createReceiver (const Address &address)
 
QPID_MESSAGING_EXTERN Receiver createReceiver (const std::string &address)
 
QPID_MESSAGING_EXTERN Sender getSender (const std::string &name) const
 
QPID_MESSAGING_EXTERN Receiver getReceiver (const std::string &name) const
 
QPID_MESSAGING_EXTERN Connection getConnection () const
 
QPID_MESSAGING_EXTERN bool hasError ()
 
QPID_MESSAGING_EXTERN void checkError ()
 
- Public Member Functions inherited from qpid::messaging::Handle< SessionImpl >
QPID_MESSAGING_INLINE_EXTERN bool isValid () const
 
QPID_MESSAGING_INLINE_EXTERN bool isNull () const
 
QPID_MESSAGING_INLINE_EXTERN operator bool () const
 
QPID_MESSAGING_INLINE_EXTERN bool operator! () const
 
void swap (Handle< SessionImpl > &h)
 

Friends

class qpid::messaging::PrivateImplRef< Session >
 

Additional Inherited Members

- Protected Types inherited from qpid::messaging::Handle< SessionImpl >
typedef SessionImpl Impl
 
- Protected Attributes inherited from qpid::messaging::Handle< SessionImpl >
Impl * impl
 

Detailed Description

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

Member Function Documentation

◆ acknowledge() [1/2]

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

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

Parameters
syncif true, blocks until the acknowledgement has been processed by the server

◆ acknowledge() [2/2]

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

Acknowledges the specified message.

◆ acknowledgeUpTo()

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

Acknowledges all message up to the specified message.

◆ checkError()

QPID_MESSAGING_EXTERN 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.

◆ close()

QPID_MESSAGING_EXTERN 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().

◆ commit()

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

Commits the sessions transaction.

Exceptions
TransactionAbortedif the transaction was rolled back due to an error.
TransactionUnknownif the connection was lost and the transaction outcome is unknown. forcing an automatic rollback.

◆ createReceiver() [1/2]

QPID_MESSAGING_EXTERN Receiver qpid::messaging::Session::createReceiver ( const Address address)

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

Exceptions
ResolutionErrorif there is an error in resolving the address

◆ createReceiver() [2/2]

QPID_MESSAGING_EXTERN Receiver qpid::messaging::Session::createReceiver ( const std::string &  address)

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

Exceptions
ResolutionErrorif there is an error in resolving the address
MalformedAddressif the syntax of address is not valid

◆ createSender() [1/2]

QPID_MESSAGING_EXTERN Sender qpid::messaging::Session::createSender ( const Address address)

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

Exceptions
ResolutionErrorif there is an error in resolving the address

◆ createSender() [2/2]

QPID_MESSAGING_EXTERN Sender qpid::messaging::Session::createSender ( const std::string &  address)

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

Exceptions
ResolutionErrorif there is an error in resolving the address
MalformedAddressif the syntax of address is not valid

◆ getConnection()

QPID_MESSAGING_EXTERN Connection qpid::messaging::Session::getConnection ( ) const

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

◆ getReceivable()

QPID_MESSAGING_EXTERN 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.

◆ getReceiver()

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

Returns the receiver with the specified name.

Exceptions
KeyErrorif there is none for that name.

◆ getSender()

QPID_MESSAGING_EXTERN Sender qpid::messaging::Session::getSender ( const std::string &  name) const

Returns the sender with the specified name.

Exceptions
KeyErrorif there is none for that name.

◆ getUnsettledAcks()

QPID_MESSAGING_EXTERN 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.

◆ hasError()

QPID_MESSAGING_EXTERN bool qpid::messaging::Session::hasError ( )
Returns
true if the session has been rendered invalid by some exception, false if it is valid for use.

◆ nextReceiver() [1/2]

QPID_MESSAGING_EXTERN 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.

◆ nextReceiver() [2/2]

QPID_MESSAGING_EXTERN 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::NoMessageAvailableif no message became available in time.

◆ reject()

QPID_MESSAGING_EXTERN 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.

◆ release()

QPID_MESSAGING_EXTERN 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.

◆ sync()

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

Request synchronisation with the server.

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

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