Qpid Proton C++ API  0.17.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
messaging_handler Class Reference

A handler for Proton messaging events. More...

#include <messaging_handler.hpp>

Public Member Functions

virtual void on_container_start (container &c)
 The container event loop is starting. More...
 
virtual void on_container_stop (container &c)
 The container event loop is stopping. More...
 
virtual void on_message (delivery &d, message &m)
 A message is received.
 
virtual void on_sendable (sender &s)
 A message can be sent.
 
virtual void on_transport_open (transport &t)
 The underlying network transport is open.
 
virtual void on_transport_close (transport &t)
 The underlying network transport has closed.
 
virtual void on_transport_error (transport &t)
 The underlying network transport has closed with an error condition. More...
 
virtual void on_connection_open (connection &c)
 The remote peer opened the connection.
 
virtual void on_connection_close (connection &c)
 The remote peer closed the connection.
 
virtual void on_connection_error (connection &c)
 The remote peer closed the connection with an error condition.
 
virtual void on_session_open (session &s)
 The remote peer opened the session.
 
virtual void on_session_close (session &s)
 The remote peer closed the session.
 
virtual void on_session_error (session &s)
 The remote peer closed the session with an error condition.
 
virtual void on_receiver_open (receiver &l)
 The remote peer opened the link.
 
virtual void on_receiver_detach (receiver &l)
 The remote peer detached the link.
 
virtual void on_receiver_close (receiver &l)
 The remote peer closed the link.
 
virtual void on_receiver_error (receiver &l)
 The remote peer closed the link with an error condition.
 
virtual void on_sender_open (sender &l)
 The remote peer opened the link.
 
virtual void on_sender_detach (sender &l)
 The remote peer detached the link.
 
virtual void on_sender_close (sender &l)
 The remote peer closed the link.
 
virtual void on_sender_error (sender &l)
 The remote peer closed the link with an error condition.
 
virtual void on_tracker_accept (tracker &d)
 The receiving peer accepted a transfer.
 
virtual void on_tracker_reject (tracker &d)
 The receiving peer rejected a transfer.
 
virtual void on_tracker_release (tracker &d)
 The receiving peer released a transfer.
 
virtual void on_tracker_settle (tracker &d)
 The receiving peer settled a transfer.
 
virtual void on_delivery_settle (delivery &d)
 The sending peer settled a transfer.
 
virtual void on_sender_drain_start (sender &s)
 Experimental - The receiving peer has requested a drain of remaining credit. More...
 
virtual void on_receiver_drain_finish (receiver &r)
 Experimental - The credit outstanding at the time of the call to receiver::drain has been consumed or returned. More...
 
virtual void on_error (const error_condition &c)
 Fallback error handling.
 

Detailed Description

A handler for Proton messaging events.

Subclass and override the event-handling member functions.

Close and error handling

There are several objects that have on_X_close and on_X_error functions. They are called as follows:

  • If X is closed cleanly, with no error status, then on_X_close is called.
  • If X is closed with an error, then on_X_error is called, followed by on_X_close. The error condition is also available in on_X_close from X::condition().

By default, if you do not implement on_X_error, it will call on_error. If you do not implement on_error it will throw a proton::error exception, which may not be what you want but does help to identify forgotten error handling quickly.

Resource cleanup

Every on_X_open event is paired with an on_X_close event which can clean up any resources created by the open handler. In particular this is still true if an error is reported with an on_X_error event. The error-handling logic doesn't have to manage resource clean up. It can assume that the close event will be along to handle it.

Examples:
broker.cpp, broker.hpp, client.cpp, direct_recv.cpp, direct_send.cpp, helloworld.cpp, helloworld_direct.cpp, mt/broker.cpp, scheduled_send.cpp, scheduled_send_03.cpp, server.cpp, server_direct.cpp, service_bus.cpp, simple_recv.cpp, and simple_send.cpp.

Member Function Documentation

virtual void on_container_start ( container c)
virtual
virtual void on_container_stop ( container c)
virtual

The container event loop is stopping.

This is the last event received before the container event loop stops.

virtual void on_receiver_drain_finish ( receiver r)
virtual

Experimental - The credit outstanding at the time of the call to receiver::drain has been consumed or returned.

virtual void on_sender_drain_start ( sender s)
virtual

Experimental - The receiving peer has requested a drain of remaining credit.

virtual void on_transport_error ( transport t)
virtual

The underlying network transport has closed with an error condition.

Examples:
broker.cpp, and broker.hpp.

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