RMQ - RabbitMQ C++ Library
rmqa_tracingproducerimpl.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#ifndef INCLUDED_RMQA_TRACINGPRODUCERIMPL
17#define INCLUDED_RMQA_TRACINGPRODUCERIMPL
18
19#include <rmqa_producerimpl.h>
20
21#include <rmqp_producertracing.h>
22
23#include <bsl_memory.h>
24#include <bsls_keyword.h>
25
26//@PURPOSE: Implements the rmqa::Producer interface and specialises for tracing
27//
28//@CLASSES:
29// rmqa::ProducerImpl: Manages interaction between rmqa <-> rmq internals
30
31namespace BloombergLP {
32namespace rmqa {
33
35 public:
37 public:
38 Factory(const bsl::shared_ptr<const rmqt::Endpoint>& endpoint,
39 const bsl::shared_ptr<rmqp::ProducerTracing>& tracing);
40
41 virtual bsl::shared_ptr<ProducerImpl>
42 create(uint16_t maxOutstandingConfirms,
43 const rmqt::ExchangeHandle& exchange,
44 const bsl::shared_ptr<rmqamqp::SendChannel>& channel,
45 bdlmt::ThreadPool& threadPool,
46 rmqio::EventLoop& eventLoop) const BSLS_KEYWORD_OVERRIDE;
47
48 private:
49 bsl::shared_ptr<const rmqt::Endpoint> d_endpoint;
50 bsl::shared_ptr<rmqp::ProducerTracing> d_tracing;
51 };
52
53 // CREATORS
54 TracingProducerImpl(uint16_t maxOutstandingConfirms,
55 const bsl::shared_ptr<rmqamqp::SendChannel>& channel,
56 bdlmt::ThreadPool& threadPool,
57 rmqio::EventLoop& eventLoop,
58 const bsl::string& exchangeName,
59 const bsl::shared_ptr<const rmqt::Endpoint>& endpoint,
60 const bsl::shared_ptr<rmqp::ProducerTracing>& tracing);
61
62 SendStatus send(const rmqt::Message& message,
63 const bsl::string& routingKey,
64 const rmqp::Producer::ConfirmationCallback& confirmCallback,
65 const bsls::TimeInterval& timeout) BSLS_KEYWORD_OVERRIDE;
66
68 trySend(const rmqt::Message& message,
69 const bsl::string& routingKey,
70 const rmqp::Producer::ConfirmationCallback& confirmCallback)
71 BSLS_KEYWORD_OVERRIDE;
72
73 private:
74 bsl::string d_exchangeName;
75 bsl::shared_ptr<const rmqt::Endpoint> d_endpoint;
76 bsl::shared_ptr<rmqp::ProducerTracing> d_tracing;
77
78}; // class TracingProducerImpl
79
80} // namespace rmqa
81} // namespace BloombergLP
82
83#endif
Definition: rmqa_producerimpl.h:56
Definition: rmqa_producerimpl.h:54
Definition: rmqa_tracingproducerimpl.h:36
Definition: rmqa_tracingproducerimpl.h:34
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_tracingproducerimpl.cpp:108
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_tracingproducerimpl.cpp:83
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