RMQ - RabbitMQ C++ Library
rmqa_producer.h
1// Copyright 2020-2023 Bloomberg Finance L.P.
2// SPDX-License-Identifier: Apache-2.0
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16// rmqa_producer.h
17#ifndef INCLUDED_RMQA_PRODUCER
18#define INCLUDED_RMQA_PRODUCER
19
20#include <rmqa_topologyupdate.h>
21#include <rmqp_messagetransformer.h>
22#include <rmqp_producer.h>
23#include <rmqp_topology.h>
24#include <rmqt_exchange.h>
25#include <rmqt_message.h>
26#include <rmqt_queue.h>
27#include <rmqt_result.h>
28
29#include <bsl_memory.h>
30#include <bsl_string.h>
31#include <bslma_managedptr.h>
32#include <bsls_timeinterval.h>
33
34namespace BloombergLP {
35namespace rmqa {
36
43class Producer {
44 public:
45 // CREATORS
49 explicit Producer(bslma::ManagedPtr<rmqp::Producer>& impl);
50
51 ~Producer();
52
53 // MANIPULATORS
88 send(const rmqt::Message& message,
89 const bsl::string& routingKey,
90 const rmqp::Producer::ConfirmationCallback& confirmCallback,
91 const bsls::TimeInterval& timeout = bsls::TimeInterval());
92
98 void addTransformer(
99 const bsl::shared_ptr<rmqp::MessageTransformer>& transformer);
100
141 send(const rmqt::Message& message,
142 const bsl::string& routingKey,
143 rmqt::Mandatory::Value mandatoryFlag,
144 const rmqp::Producer::ConfirmationCallback& confirmCallback,
145 const bsls::TimeInterval& timeout = bsls::TimeInterval());
146
155 updateTopology(const rmqa::TopologyUpdate& topologyUpdate,
156 const bsls::TimeInterval& timeout = bsls::TimeInterval(0));
157
158#ifdef USES_LIBRMQ_EXPERIMENTAL_FEATURES
193 trySend(const rmqt::Message& message,
194 const bsl::string& routingKey,
195 const rmqp::Producer::ConfirmationCallback& confirmCallback);
196#endif
197
206 waitForConfirms(const bsls::TimeInterval& timeout = bsls::TimeInterval());
207
208 private:
209 Producer(const Producer&) BSLS_KEYWORD_DELETED;
210 Producer& operator=(const Producer&) BSLS_KEYWORD_DELETED;
211
212 private:
213 bslma::ManagedPtr<rmqp::Producer> d_impl;
214
215}; // class Producer
216
217} // namespace rmqa
218} // namespace BloombergLP
219
220#endif // ! INCLUDED_RMQA_PRODUCER
Provide a RabbitMQ Producer API for publishing to a specific Exchange.
Definition: rmqa_producer.h:43
rmqt::Result waitForConfirms(const bsls::TimeInterval &timeout=bsls::TimeInterval())
Definition: rmqa_producer.cpp:62
void addTransformer(const bsl::shared_ptr< rmqp::MessageTransformer > &transformer)
Definition: rmqa_producer.cpp:28
rmqp::Producer::SendStatus send(const rmqt::Message &message, const bsl::string &routingKey, const rmqp::Producer::ConfirmationCallback &confirmCallback, const bsls::TimeInterval &timeout=bsls::TimeInterval())
Definition: rmqa_producer.cpp:35
rmqt::Result updateTopology(const rmqa::TopologyUpdate &topologyUpdate, const bsls::TimeInterval &timeout=bsls::TimeInterval(0))
Definition: rmqa_producer.cpp:68
Producer(bslma::ManagedPtr< rmqp::Producer > &impl)
Definition: rmqa_producer.cpp:21
Definition: rmqa_topologyupdate.h:27
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
A result of an operation.
Definition: rmqt_result.h:37