]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_amqp.h
bbfce2d5dcd66a293699233131ba7dd3e97fcf0b
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/smart_ptr/intrusive_ptr.hpp>
10 #include "include/common_fwd.h"
13 // forward declaration of connection object
16 typedef boost::intrusive_ptr
<connection_t
> connection_ptr_t
;
18 // required interfaces needed so that connection_t could be used inside boost::intrusive_ptr
19 void intrusive_ptr_add_ref(const connection_t
* p
);
20 void intrusive_ptr_release(const connection_t
* p
);
22 // the reply callback is expected to get an integer parameter
23 // indicating the result, and not to return anything
24 typedef std::function
<void(int)> reply_callback_t
;
26 // initialize the amqp manager
27 bool init(CephContext
* cct
);
29 // shutdown the amqp manager
32 // connect to an amqp endpoint
33 connection_ptr_t
connect(const std::string
& url
, const std::string
& exchange
);
35 // publish a message over a connection that was already created
36 int publish(connection_ptr_t
& conn
,
37 const std::string
& topic
,
38 const std::string
& message
);
40 // publish a message over a connection that was already created
41 // and pass a callback that will be invoked (async) when broker confirms
42 // receiving the message
43 int publish_with_confirm(connection_ptr_t
& conn
,
44 const std::string
& topic
,
45 const std::string
& message
,
48 // convert the integer status returned from the "publish" function to a string
49 std::string
status_to_string(int s
);
51 // number of connections
52 size_t get_connection_count();
54 // return the number of messages that were sent
55 // to broker, but were not yet acked/nacked/timedout
56 size_t get_inflight();
58 // running counter of successfully queued messages
61 // running counter of dequeued messages
62 size_t get_dequeued();
64 // number of maximum allowed connections
65 size_t get_max_connections();
67 // number of maximum allowed inflight messages
68 size_t get_max_inflight();
70 // maximum number of messages in the queue
71 size_t get_max_queue();
73 // disconnect from an amqp broker
74 bool disconnect(connection_ptr_t
& conn
);