]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_amqp.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
8 #include <boost/optional.hpp>
9 #include <boost/smart_ptr/intrusive_ptr.hpp>
11 #include "include/common_fwd.h"
14 // forward declaration of connection object
17 typedef boost::intrusive_ptr
<connection_t
> connection_ptr_t
;
19 // required interfaces needed so that connection_t could be used inside boost::intrusive_ptr
20 void intrusive_ptr_add_ref(const connection_t
* p
);
21 void intrusive_ptr_release(const connection_t
* p
);
23 // the reply callback is expected to get an integer parameter
24 // indicating the result, and not to return anything
25 typedef std::function
<void(int)> reply_callback_t
;
27 // initialize the amqp manager
28 bool init(CephContext
* cct
);
30 // shutdown the amqp manager
33 // connect to an amqp endpoint
34 connection_ptr_t
connect(const std::string
& url
, const std::string
& exchange
, bool mandatory_delivery
, bool verify_ssl
,
35 boost::optional
<const std::string
&> ca_location
);
37 // publish a message over a connection that was already created
38 int publish(connection_ptr_t
& conn
,
39 const std::string
& topic
,
40 const std::string
& message
);
42 // publish a message over a connection that was already created
43 // and pass a callback that will be invoked (async) when broker confirms
44 // receiving the message
45 int publish_with_confirm(connection_ptr_t
& conn
,
46 const std::string
& topic
,
47 const std::string
& message
,
50 // convert the integer status returned from the "publish" function to a string
51 std::string
status_to_string(int s
);
53 // number of connections
54 size_t get_connection_count();
56 // return the number of messages that were sent
57 // to broker, but were not yet acked/nacked/timedout
58 size_t get_inflight();
60 // running counter of successfully queued messages
63 // running counter of dequeued messages
64 size_t get_dequeued();
66 // number of maximum allowed connections
67 size_t get_max_connections();
69 // number of maximum allowed inflight messages
70 size_t get_max_inflight();
72 // maximum number of messages in the queue
73 size_t get_max_queue();