containerabstract

A top-level container of connections, sessions, senders, and receivers. More...

`#include <container.hpp>`

Inheritance diagram for container:
[legend]

## Public Member Functions

virtual returned< connection > | connect (const std::string &url, const connection_options &)=0
| Connect to `url` and send an open request to the remote peer. More...
virtual returned< connection > | connect (const std::string &url)=0
| Connect to `url` and send an open request to the remote peer.
virtual listener | listen (const std::string &url, listen_handler &lh)=0
| Start listening on url. More...
virtual listener | listen (const std::string &url, const connection_options &)=0
| Listen with a fixed set of options for all accepted connections. More...
virtual listener | listen (const std::string &url)=0
| Start listening on URL. More...
virtual void | run ()=0
| Run the container in this thread. More...
virtual void | auto_stop (bool)=0
| If true, stop the container when all active connections and listeners are closed. More...
virtual void | stop (const error_condition &err)=0
| Experimental - Stop the container with an error_condition err. More...
virtual void | stop ()=0
| Experimental - Stop the container with an empty error condition. More...
virtual returned< sender > | open_sender (const std::string &url)=0
| Open a connection and sender for `url`.
virtual returned< sender > | open_sender (const std::string &url, const proton::sender_options &o)=0
| Open a connection and sender for `url`. More...
virtual returned< sender > | open_sender (const std::string &url, const connection_options &c)=0
| Open a connection and sender for `url`. More...
virtual returned< sender > | open_sender (const std::string &url, const proton::sender_options &o, const connection_options &c)=0
| Open a connection and sender for `url`. More...
virtual returned< receiver > | open_receiver (const std::string &url)=0
| Open a connection and receiver for `url`.
virtual returned< receiver > | open_receiver (const std::string &url, const proton::receiver_options &o)=0
| Open a connection and receiver for `url`. More...
virtual returned< receiver > | open_receiver (const std::string &url, const connection_options &c)=0
| Open a connection and receiver for `url`. More...
virtual returned< receiver > | open_receiver (const std::string &url, const proton::receiver_options &o, const connection_options &c)=0
| Open a connection and receiver for `url`. More...
virtual std::string | id () const =0
| A unique identifier for the container.
virtual void | client_connection_options (const connection_options &)=0
| Connection options that will be to outgoing connections. More...
virtual connection_options | client_connection_options () const =0
| Connection options that will be to outgoing connections. More...
virtual void | server_connection_options (const connection_options &)=0
| Connection options that will be applied to incoming connections. More...
virtual connection_options | server_connection_options () const =0
| Connection options that will be applied to incoming connections. More...
virtual void | sender_options (const class sender_options &)=0
| Sender options applied to senders created by this container. More...
virtual class sender_options | sender_options () const =0
| Sender options applied to senders created by this container. More...
virtual void | receiver_options (const class receiver_options &)=0
| Receiver options applied to receivers created by this container. More...
virtual class receiver_options | receiver_options () const =0
| Receiver options applied to receivers created by this container. More...
virtual void | schedule (duration, void_function0 &)=0
| Schedule a function to be called after the duration. More...

## Detailed Description

A top-level container of connections, sessions, senders, and receivers.

A container gives a unique identity to each communicating peer. It is often a process-level object.

It serves as an entry point to the API, allowing connections, senders, and receivers to be established. It can be supplied with an event handler in order to intercept important messaging events, such as newly received messages or newly issued credit for sending messages.

Examples:
  broker.cpp, client.cpp, direct_recv.cpp, direct_send.cpp, helloworld.cpp, helloworld_direct.cpp, server.cpp, server_direct.cpp, service_bus.cpp, simple_recv.cpp, and simple_send.cpp.

## Member Function Documentation

## auto_stop()

virtual void auto_stop | ( | bool |  | ) |

pure virtual

If true, stop the container when all active connections and listeners are closed.

If false the container will keep running till stop() is called.

auto_stop is set by default when a new container is created.

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## client_connection_options() [1/2]

virtual void client_connection_options | ( | const connection_options & |  | ) |

pure virtual

Connection options that will be to outgoing connections.

These are applied first and overriden by options provided in connect() and messaging_handler::on_connection_open().

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## client_connection_options() [2/2]

virtual connection_options client_connection_options | ( |  | ) | const

pure virtual

Connection options that will be to outgoing connections.

These are applied first and overriden by options provided in connect() and messaging_handler::on_connection_open().

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## connect()

virtual returned<connection> connect | ( | const std::string & | url,
|  | const connection_options & |
| ) |  |

pure virtual

Connect to `url` and send an open request to the remote peer.

Options are applied to the connection as follows, values in later options override earlier ones:

1. client_connection_options()
2. options passed to connect()

The handler in the composed options is used to call proton::messaging_handler::on_connection_open() when the remote peer's open response is received.

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

Examples:
  helloworld.cpp, server.cpp, and service_bus.cpp.

## listen() [1/3]

virtual listener listen | ( | const std::string & | url,
|  | listen_handler & | lh
| ) |  |

pure virtual

Start listening on url.

Calls to the listen_handler are serialized for this listener, but handlers attached to separate listeners may be called concurrently.

Parameters

  url | identifies a listening url.
  lh | handles listening events

Returns
  listener lets you stop listening

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

Examples:
  broker.cpp, direct_recv.cpp, direct_send.cpp, helloworld_direct.cpp, and server_direct.cpp.

## listen() [2/3]

virtual listener listen | ( | const std::string & | url,
|  | const connection_options & |
| ) |  |

pure virtual

Listen with a fixed set of options for all accepted connections.

See listen(const std::string&, listen_handler&)

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## listen() [3/3]

virtual listener listen | ( | const std::string & | url | ) |

pure virtual

Start listening on URL.

New connections will use the handler from server_connection_options()

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## open_receiver() [1/3]

virtual returned<receiver> open_receiver | ( | const std::string & | url,
|  | const proton::receiver_options & | o
| ) |  |

pure virtual

Open a connection and receiver for `url`.

Supplied receiver options will override the container's template options.

## open_receiver() [2/3]

virtual returned<receiver> open_receiver | ( | const std::string & | url,
|  | const connection_options & | c
| ) |  |

pure virtual

Open a connection and receiver for `url`.

Supplied receiver or connection options will override the container's template options.

## open_receiver() [3/3]

virtual returned<receiver> open_receiver | ( | const std::string & | url,
|  | const proton::receiver_options & | o,
|  | const connection_options & | c
| ) |  |

pure virtual

Open a connection and receiver for `url`.

Supplied receiver or connection options will override the container's template options.

## open_sender() [1/3]

virtual returned<sender> open_sender | ( | const std::string & | url,
|  | const proton::sender_options & | o
| ) |  |

pure virtual

Open a connection and sender for `url`.

Supplied sender options will override the container's template options.

## open_sender() [2/3]

virtual returned<sender> open_sender | ( | const std::string & | url,
|  | const connection_options & | c
| ) |  |

pure virtual

Open a connection and sender for `url`.

Supplied connection options will override the container's template options.

## open_sender() [3/3]

virtual returned<sender> open_sender | ( | const std::string & | url,
|  | const proton::sender_options & | o,
|  | const connection_options & | c
| ) |  |

pure virtual

Open a connection and sender for `url`.

Supplied sender or connection options will override the container's template options.

## receiver_options() [1/2]

virtual class receiver_options receiver_options | ( |  | ) | const

pure virtual

Receiver options applied to receivers created by this container.

They are applied before messaging_handler::on_receiver_open() and can be overridden.

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## receiver_options() [2/2]

virtual void receiver_options | ( | const class receiver_options & |  | ) |

pure virtual

Receiver options applied to receivers created by this container.

They are applied before messaging_handler::on_receiver_open() and can be overridden.

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## run()

virtual void run | ( |  | ) |

pure virtual

Run the container in this thread.

Returns when the container stops.

See also
  auto_stop() and stop().

With a multithreaded container, call run() in multiple threads to create a thread pool.

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

Examples:
  mt/broker.cpp.

## schedule()

virtual void schedule | ( | duration | ,
|  | void_function0 & |
| ) |  |

pure virtual

Schedule a function to be called after the duration.

C++03 compatible, for C++11 use the schedule(duration, std::function<void()>)

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

Examples:
  service_bus.cpp.

## sender_options() [1/2]

virtual void sender_options | ( | const class sender_options & |  | ) |

pure virtual

Sender options applied to senders created by this container.

They are applied before messaging_handler::on_sender_open() and can be overridden.

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## sender_options() [2/2]

virtual class sender_options sender_options | ( |  | ) | const

pure virtual

Sender options applied to senders created by this container.

They are applied before messaging_handler::on_sender_open() and can be overridden.

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## server_connection_options() [1/2]

virtual void server_connection_options | ( | const connection_options & |  | ) |

pure virtual

Connection options that will be applied to incoming connections.

These are applied first and overridden by options provided in listen(), listen_handler::on_accept() and messaging_handler::on_connection_open().

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## server_connection_options() [2/2]

virtual connection_options server_connection_options | ( |  | ) | const

pure virtual

Connection options that will be applied to incoming connections.

These are applied first and overridden by options provided in listen(), listen_handler::on_accept() and messaging_handler::on_connection_open().

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

## stop() [1/2]

virtual void stop | ( | const error_condition & | err | ) |

pure virtual

Experimental - Stop the container with an error_condition err.

- Abort all open connections and listeners.
- Process final handler events and injected functions
- If `!err.empty()`, handlers will receive on_transport_error
- run() will return in all threads.

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

Examples:
  mt/broker.cpp.

## stop() [2/2]

virtual void stop | ( |  | ) |

pure virtual

Experimental - Stop the container with an empty error condition.

See also
  stop(const error_condition&)

Implemented in container_ref< Ptr >, and container_ref< std::auto_ptr< container > >.

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

- proton/container.hpp