16#ifndef INCLUDED_RMQA_PRODUCERIMPL
17#define INCLUDED_RMQA_PRODUCERIMPL
19#include <rmqp_messagetransformer.h>
20#include <rmqp_producer.h>
21#include <rmqt_endpoint.h>
22#include <rmqt_exchange.h>
23#include <rmqt_future.h>
24#include <rmqt_message.h>
25#include <rmqt_queue.h>
26#include <rmqt_result.h>
28#include <rmqamqp_sendchannel.h>
31#include <bdlmt_threadpool.h>
32#include <bslma_managedptr.h>
33#include <bslmt_mutex.h>
34#include <bslmt_timedsemaphore.h>
35#include <bsls_keyword.h>
36#include <bsls_timeinterval.h>
38#include <bsl_memory.h>
39#include <bsl_string.h>
40#include <bsl_unordered_map.h>
41#include <bsl_vector.h>
48namespace BloombergLP {
59 virtual bsl::shared_ptr<ProducerImpl>
60 create(uint16_t maxOutstandingConfirms,
61 const rmqt::ExchangeHandle& exchange,
62 const bsl::shared_ptr<rmqamqp::SendChannel>& channel,
63 bdlmt::ThreadPool& threadPool,
64 rmqio::EventLoop& eventLoop)
const;
69 const bsl::shared_ptr<rmqamqp::SendChannel>& channel,
70 bdlmt::ThreadPool& threadPool,
71 rmqio::EventLoop& eventLoop);
76 addTransformer(const bsl::shared_ptr<rmqp::MessageTransformer>& transformer)
77 BSLS_KEYWORD_OVERRIDE;
80 const bsl::
string& routingKey,
82 const bsls::TimeInterval& timeout) BSLS_KEYWORD_OVERRIDE;
85 const bsl::
string& routingKey,
86 rmqt::Mandatory::Value mandatoryFlag,
88 const bsls::TimeInterval& timeout) BSLS_KEYWORD_OVERRIDE;
91 trySend(const rmqt::Message& message,
92 const bsl::
string& routingKey,
94 BSLS_KEYWORD_OVERRIDE;
100 waitForConfirms(const bsls::TimeInterval& timeout = bsls::TimeInterval(0))
101 BSLS_KEYWORD_OVERRIDE;
109 bdlmt::ThreadPool& _threadPool,
110 uint16_t maxOutstandingConfirms)
114 , threadPool(_threadPool)
115 , outstandingMessagesCap(maxOutstandingConfirms)
116 , waitForConfirmsFuture()
121 CallbackMap callbackMap;
125 bdlmt::ThreadPool& threadPool;
126 bslmt::TimedSemaphore outstandingMessagesCap;
127 bsl::optional<rmqt::Future<>::Pair> waitForConfirmsFuture;
134 bool registerUniqueCallback(
135 const bdlb::Guid& guid,
140 const bsl::string& routingKey,
141 rmqt::Mandatory::Value mandatoryFlag,
146 const bsl::string& routingKey,
147 rmqt::Mandatory::Value mandatoryFlag,
149 const bsls::TimeInterval& timeout);
154 rmqio::EventLoop& d_eventLoop;
156 bsl::shared_ptr<rmqamqp::SendChannel> d_channel;
158 bsl::shared_ptr<SharedState> d_sharedState;
160 bsl::vector<bsl::shared_ptr<rmqp::MessageTransformer> > d_transformers;
Definition: rmqa_producerimpl.h:56
Definition: rmqa_producerimpl.h:54
SendStatus send(const rmqt::Message &message, const bsl::string &routingKey, const rmqp::Producer::ConfirmationCallback &confirmCallback, const bsls::TimeInterval &timeout) BSLS_KEYWORD_OVERRIDE
Send a message with the given routingKey to the exchange targeted by the producer.
Definition: rmqa_producerimpl.cpp:175
SendStatus trySend(const rmqt::Message &message, const bsl::string &routingKey, const rmqp::Producer::ConfirmationCallback &confirmCallback) BSLS_KEYWORD_OVERRIDE
Send a message with the given routingKey to the exchange targeted by the producer.
Definition: rmqa_producerimpl.cpp:275
rmqt::Future updateTopologyAsync(const rmqt::TopologyUpdate &topologyUpdate) BSLS_KEYWORD_OVERRIDE
Updates topology.
Definition: rmqa_producerimpl.cpp:293
rmqt::Result waitForConfirms(const bsls::TimeInterval &timeout=bsls::TimeInterval(0)) BSLS_KEYWORD_OVERRIDE
Wait for all outstanding publisher confirms to arrive.
Definition: rmqa_producerimpl.cpp:321
Provide a RabbitMQ Producer API for publishing to a specific Exchange.
Definition: rmqa_producer.h:43
Definition: rmqa_topologyupdate.h:27
RabbitMQ Producer API for publishing to a specific Exchange.
Definition: rmqp_producer.h:46
bsl::function< void(const rmqt::Message &, const bsl::string &routingKey, const rmqt::ConfirmResponse &)> ConfirmationCallback
Invoked on receipt of message confirmation.
Definition: rmqp_producer.h:71
SendStatus
Possible results of rmqp::Producer::send.
Definition: rmqp_producer.h:50
An AMQP content message.
Definition: rmqt_message.h:43
Definition: rmqa_producerimpl.h:107