Qpid Proton C++ API 0.39.0
 
Loading...
Searching...
No Matches
container.hpp
Go to the documentation of this file.
1#ifndef PROTON_CONTAINER_HPP
2#define PROTON_CONTAINER_HPP
3
4/*
5 *
6 * Licensed to the Apache Software Foundation (ASF) under one
7 * or more contributor license agreements. See the NOTICE file
8 * distributed with this work for additional information
9 * regarding copyright ownership. The ASF licenses this file
10 * to you under the Apache License, Version 2.0 (the
11 * "License"); you may not use this file except in compliance
12 * with the License. You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an
18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19 * KIND, either express or implied. See the License for the
20 * specific language governing permissions and limitations
21 * under the License.
22 *
23 */
24
25#include "./fwd.hpp"
26#include "./returned.hpp"
27#include "./types_fwd.hpp"
28
29#include "./internal/export.hpp"
30
31#include <memory>
32#include <string>
33
36
37namespace proton {
38typedef uint64_t work_handle;
39
50class PN_CPP_CLASS_EXTERN container {
51 public:
62 PN_CPP_EXTERN container(messaging_handler& handler, const std::string& id);
63
72 PN_CPP_EXTERN container(messaging_handler& handler);
73
76 PN_CPP_EXTERN container(const std::string& id);
77
81 PN_CPP_EXTERN container();
82
92 PN_CPP_EXTERN ~container();
93
108 PN_CPP_EXTERN returned<connection> connect(const std::string& conn_url,
109 const connection_options& conn_opts);
110
114 PN_CPP_EXTERN returned<connection> connect(const std::string& conn_url);
115
120
133 PN_CPP_EXTERN listener listen(const std::string& listen_url,
134 listen_handler& handler);
135
144 PN_CPP_EXTERN listener listen(const std::string& listen_url,
145 const connection_options& conn_opts);
146
152 PN_CPP_EXTERN listener listen(const std::string& listen_url);
153
162 PN_CPP_EXTERN void run();
163
170 PN_CPP_EXTERN void run(int count);
171
178 PN_CPP_EXTERN void auto_stop(bool enabled);
179
183 PN_CPP_EXTERN void stop(const error_condition& err);
184
197 PN_CPP_EXTERN void stop();
198
202 PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url);
203
210 PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
211 const proton::sender_options& snd_opts);
212
219 PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
220 const connection_options& conn_opts);
221
228 PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
229 const proton::sender_options& snd_opts,
230 const connection_options& conn_opts);
231
235 PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url);
236
237
244 PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
245 const proton::receiver_options& rcv_opts);
246
253 PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
254 const connection_options& conn_opts);
255
262 PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
263 const proton::receiver_options& rcv_opts,
264 const connection_options& conn_opts);
265
267 PN_CPP_EXTERN std::string id() const;
268
272 PN_CPP_EXTERN void client_connection_options(const connection_options& conn_opts);
273
276
281 PN_CPP_EXTERN void server_connection_options(const connection_options& conn_opts);
282
285
289 PN_CPP_EXTERN void sender_options(const class sender_options& snd_opts);
290
292 PN_CPP_EXTERN class sender_options sender_options() const;
293
297 PN_CPP_EXTERN void receiver_options(const class receiver_options& rcv_opts);
298
300 PN_CPP_EXTERN class receiver_options receiver_options() const;
301
307 PN_CPP_EXTERN work_handle schedule(duration dur, work fn);
308
310 PN_CPP_EXTERN PN_CPP_DEPRECATED("Use 'container::schedule(duration, work)'") work_handle schedule(duration dur, void_function0& fn);
311
313 PN_CPP_EXTERN void cancel(work_handle);
314
315 private:
318 PN_CPP_EXTERN work_handle schedule(duration dur, internal::v03::work fn);
319
320 class impl;
321 std::unique_ptr<impl> impl_;
322
324 friend class connection_options;
325 friend class session_options;
326 friend class receiver_options;
327 friend class sender_options;
328 friend class work_queue;
330};
331
332} // proton
333
334#endif // PROTON_CONTAINER_HPP
Options for creating a connection.
Definition: connection_options.hpp:67
A top-level container of connections, sessions, and links.
Definition: container.hpp:50
connection_options server_connection_options() const
Connection options applied to incoming connections.
void run()
Run the container in the current thread.
void auto_stop(bool enabled)
Enable or disable automatic container stop.
work_handle schedule(duration dur, work fn)
Schedule fn for execution after a duration.
returned< receiver > open_receiver(const std::string &addr_url, const connection_options &conn_opts)
Open a connection and receiver for addr_url.
returned< sender > open_sender(const std::string &addr_url, const connection_options &conn_opts)
Open a connection and sender for addr_url.
void receiver_options(const class receiver_options &rcv_opts)
Receiver options applied to receivers created by this container.
container(messaging_handler &handler)
Create a container with a global handler for messaging events.
std::string id() const
A unique identifier for the container.
void sender_options(const class sender_options &snd_opts)
Sender options applied to senders created by this container.
returned< connection > connect()
Connect using the default Connection Configuration file.
~container()
Destroy a container.
void server_connection_options(const connection_options &conn_opts)
Connection options applied to incoming connections.
returned< sender > open_sender(const std::string &addr_url)
Open a connection and sender for addr_url.
container(const std::string &id)
Create a container.
void stop()
Stop the container with an empty error condition.
connection_options client_connection_options() const
Connection options applied to outgoing connections.
returned< sender > open_sender(const std::string &addr_url, const proton::sender_options &snd_opts, const connection_options &conn_opts)
Open a connection and sender for addr_url.
void client_connection_options(const connection_options &conn_opts)
Connection options applied to outgoing connections.
container(messaging_handler &handler, const std::string &id)
Create a container with a global handler for messaging events.
listener listen(const std::string &listen_url, listen_handler &handler)
Listen for new connections on listen_url.
returned< receiver > open_receiver(const std::string &addr_url, const proton::receiver_options &rcv_opts)
Open a connection and receiver for addr_url.
void run(int count)
Run the container with a pool of count threads, including the current thread.
listener listen(const std::string &listen_url)
Listen for new connections on listen_url.
returned< connection > connect(const std::string &conn_url)
Connect using the default Connection Configuration file.
returned< receiver > open_receiver(const std::string &addr_url)
Open a connection and receiver for addr_url.
void stop(const error_condition &err)
Stop the container with error condition err.
listener listen(const std::string &listen_url, const connection_options &conn_opts)
Listen for new connections on listen_url.
returned< receiver > open_receiver(const std::string &addr_url, const proton::receiver_options &rcv_opts, const connection_options &conn_opts)
Open a connection and receiver for addr_url.
container()
Create a container.
returned< connection > connect(const std::string &conn_url, const connection_options &conn_opts)
Connect to conn_url and send an open request to the remote peer.
returned< sender > open_sender(const std::string &addr_url, const proton::sender_options &snd_opts)
Open a connection and sender for addr_url.
A span of time in milliseconds.
Definition: duration.hpp:39
Describes an endpoint error state.
Definition: error_condition.hpp:39
Unsettled API - A handler for incoming connections.
Definition: listen_handler.hpp:39
A listener for incoming connections.
Definition: listener.hpp:33
Handler for Proton messaging events.
Definition: messaging_handler.hpp:69
Options for creating a receiver.
Definition: receiver_options.hpp:59
A return type for container methods.
Definition: returned.hpp:51
Options for creating a sender.
Definition: sender_options.hpp:60
Options for creating a session.
Definition: session_options.hpp:41
Unsettled API - A context for thread-safe execution of work.
Definition: work_queue.hpp:327
Forward declarations.
The main Proton namespace.
Definition: annotation_key.hpp:33
A return type for container methods.
Forward declarations for Proton types used to represent AMQP types.