Qpid Proton C++ API  0.37.0
connection

A connection to a remote AMQP peer. More...

#include <connection.hpp>

Inheritance diagram for connection:
endpoint

Public Member Functions

 connection ()
 Create an empty connection.
 
bool uninitialized () const
 True if the local end is uninitialized.
 
bool active () const
 True if the local end is active.
 
bool closed () const
 True if the local and remote ends are closed.
 
class error_condition error () const
 Get the error condition of the remote endpoint.
 
class containercontainer () const
 Get the container. More...
 
class work_queuework_queue () const
 Get the work_queue for the connection.
 
class transport transport () const
 Get the transport for the connection.
 
std::string virtual_host () const
 Return the remote AMQP hostname attribute for the connection.
 
std::string container_id () const
 Return the remote container ID for the connection.
 
std::string user () const
 Return authenticated user for the connection Note: The value returned is not stable until the on_transport_open event is received.
 
void open ()
 Open the connection. More...
 
void open (const connection_options &)
 Open the connection. More...
 
void close ()
 Close the connection. More...
 
void close (const error_condition &)
 Close the connection. More...
 
session open_session ()
 Open a new session.
 
session open_session (const session_options &)
 Open a new session. More...
 
session default_session ()
 Get the default session. More...
 
sender open_sender (const std::string &addr)
 Open a sender for addr on default_session().
 
sender open_sender (const std::string &addr, const sender_options &)
 Open a sender for addr on default_session(). More...
 
receiver open_receiver (const std::string &addr)
 Open a receiver for addr on default_session().
 
receiver open_receiver (const std::string &addr, const receiver_options &)
 Open a receiver for addr on default_session(). More...
 
class sender_options sender_options () const
 
class receiver_options receiver_options () const
 
session_range sessions () const
 Return all sessions on this connection.
 
receiver_range receivers () const
 Return all receivers on this connection.
 
sender_range senders () const
 Return all senders on this connection.
 
uint32_t max_frame_size () const
 Get the maximum frame size allowed by the remote peer. More...
 
uint16_t max_sessions () const
 Get the maximum number of open sessions allowed by the remote peer. More...
 
std::vector< symboloffered_capabilities () const
 Unsettled API - Extension capabilities offered by the remote peer.
 
std::vector< symboldesired_capabilities () const
 Unsettled API - Extension capabilities desired by the remote peer.
 
std::map< symbol, valueproperties () const
 Unsettled API - Connection properties
 
uint32_t idle_timeout () const
 Get the idle timeout set by the remote peer. More...
 
void wake () const
 Unsettled API - Trigger an event from another thread. More...
 
bool reconnected () const
 Unsettled API - True if this connection has been automatically re-connected. More...
 
void update_options (const connection_options &)
 Unsettled API - Update the connection options for this connection More...
 

Detailed Description

A connection to a remote AMQP peer.

Examples
broker.cpp, helloworld.cpp, multithreaded_client.cpp, server.cpp, service_bus.cpp, and simple_send.cpp.

Member Function Documentation

◆ container()

class container& container ( ) const

Get the container.

Exceptions
proton::errorif this connection is not managed by a container

◆ open() [1/2]

void open ( )

Open the connection.

See also
messaging_handler
Examples
broker.cpp.

◆ open() [2/2]

void open ( const connection_options )

Open the connection.

See also
messaging_handler

◆ close() [1/2]

◆ close() [2/2]

void close ( const error_condition )
virtual

Close the connection.

See also
messaging_handler

Implements endpoint.

◆ open_session()

session open_session ( const session_options )

Open a new session.

◆ default_session()

session default_session ( )

Get the default session.

A default session is created on the first call and reused for the lifetime of the connection.

◆ open_sender()

sender open_sender ( const std::string &  addr,
const sender_options  
)

Open a sender for addr on default_session().

◆ open_receiver()

receiver open_receiver ( const std::string &  addr,
const receiver_options  
)

Open a receiver for addr on default_session().

◆ sender_options()

◆ receiver_options()

◆ max_frame_size()

uint32_t max_frame_size ( ) const

Get the maximum frame size allowed by the remote peer.

See also
connection_options::max_frame_size

◆ max_sessions()

uint16_t max_sessions ( ) const

Get the maximum number of open sessions allowed by the remote peer.

See also
connection_options::max_sessions

◆ idle_timeout()

uint32_t idle_timeout ( ) const

Get the idle timeout set by the remote peer.

See also
connection_options::idle_timeout

◆ wake()

void wake ( ) const

Unsettled API - Trigger an event from another thread.

This method can be called from any thread. The Proton library will call messaging_handler::on_connection_wake() as soon as possible in the correct event-handling thread.

Thread-safety - This is the only proton::connection function that can be called from outside the handler thread.

Note
Spurious messaging_handler::on_connection_wake() calls can occur even if the application does not call wake().
Multiple calls to wake() may be coalesced into a single call to messaging_handler::on_connection_wake() that occurs after all of them.

The proton::work_queue interface provides an easier way execute code safely in the event-handler thread.

◆ reconnected()

bool reconnected ( ) const

Unsettled API - True if this connection has been automatically re-connected.

See also
reconnect_options, messaging_handler
Examples
simple_send.cpp.

◆ update_options()

void update_options ( const connection_options )

Unsettled API - Update the connection options for this connection

This method can be used to update the connection options used with this connection. Usually the connection options are only used during the initial connection attempt so this ability is only useful when automatically reconnect is enabled and you wish to change the connection options before the next reconnect attempt. This would usually be in the handler for the on_transport_error event

See also
messaging_handler.
Note
Connection options supplied in the parameter will be merged with the existing parameters as if connection_options::update() was used.

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