RMQ - RabbitMQ C++ Library
rmqa_topology.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_topology.h
17#ifndef INCLUDED_RMQA_TOPOLOGY
18#define INCLUDED_RMQA_TOPOLOGY
19
20#include <rmqp_topology.h>
21#include <rmqt_exchange.h>
22#include <rmqt_fieldvalue.h>
23#include <rmqt_properties.h>
24#include <rmqt_queue.h>
25
26#include <bsl_memory.h>
27#include <bsl_ostream.h>
28#include <bsl_string.h>
29
30namespace BloombergLP {
31namespace rmqa {
32
39class Topology : public rmqp::Topology {
40 public:
41 // CREATORS
42 Topology();
43 ~Topology() BSLS_KEYWORD_OVERRIDE;
44
61 rmqt::QueueHandle addQueue(const bsl::string& name = bsl::string(),
62 rmqt::AutoDelete::Value = rmqt::AutoDelete::OFF,
63 rmqt::Durable::Value = rmqt::Durable::ON,
64 const rmqt::FieldTable& args =
65 rmqt::FieldTable()) BSLS_KEYWORD_OVERRIDE;
66
88 rmqt::ExchangeHandle addExchange(
89 const bsl::string& name,
90 const rmqt::ExchangeType& exchangeType = rmqt::ExchangeType::DIRECT,
91 rmqt::AutoDelete::Value = rmqt::AutoDelete::OFF,
92 rmqt::Durable::Value = rmqt::Durable::ON,
93 rmqt::Internal::Value = rmqt::Internal::NO,
94 const rmqt::FieldTable& args = rmqt::FieldTable())
95 BSLS_KEYWORD_OVERRIDE;
96
106 rmqt::ExchangeHandle
107 addPassiveExchange(const bsl::string& name) BSLS_KEYWORD_OVERRIDE;
108
118 rmqt::QueueHandle
119 addPassiveQueue(const bsl::string& name) BSLS_KEYWORD_OVERRIDE;
120
122 void bind(const rmqt::ExchangeHandle& exchangeName,
123 const rmqt::QueueHandle& queue,
124 const bsl::string& bindingKey,
125 const rmqt::FieldTable& args = rmqt::FieldTable())
126 BSLS_KEYWORD_OVERRIDE;
127
129 void bind(const rmqt::ExchangeHandle& sourceExchange,
130 const rmqt::ExchangeHandle& destinationExchange,
131 const bsl::string& bindingKey,
132 const rmqt::FieldTable& args = rmqt::FieldTable())
133 BSLS_KEYWORD_OVERRIDE;
134
138 const rmqt::Topology& topology() const BSLS_KEYWORD_OVERRIDE;
139
144 const rmqt::ExchangeHandle defaultExchange() BSLS_KEYWORD_OVERRIDE;
145
146 friend bsl::ostream& operator<<(bsl::ostream& os, const Topology& topology);
147
148 private:
149 rmqt::ExchangeHandle
150 addExchangeImpl(const bsl::shared_ptr<rmqt::Exchange>& exchange);
151
152 rmqt::QueueHandle addQueueImpl(const bsl::shared_ptr<rmqt::Queue>& queue);
153
154 private:
155 rmqt::Topology d_topology;
156 rmqt::ExchangeHandle d_defaultExchange;
157}; // class Topology
158
159bsl::ostream& operator<<(bsl::ostream& os, const Topology& topology);
160
161} // namespace rmqa
162} // namespace BloombergLP
163
164#endif // ! INCLUDED_RMQA_TOPOLOGY
This class provides a manipulatable RabbitMQ topology structure.
Definition: rmqa_topology.h:39
rmqt::QueueHandle addQueue(const bsl::string &name=bsl::string(), rmqt::AutoDelete::Value=rmqt::AutoDelete::OFF, rmqt::Durable::Value=rmqt::Durable::ON, const rmqt::FieldTable &args=rmqt::FieldTable()) BSLS_KEYWORD_OVERRIDE
Declare a queue.
Definition: rmqa_topology.cpp:64
rmqt::QueueHandle addPassiveQueue(const bsl::string &name) BSLS_KEYWORD_OVERRIDE
Declare a dependency on an existing Queue. If the queue isn't already declared on the server,...
Definition: rmqa_topology.cpp:120
rmqt::ExchangeHandle addExchange(const bsl::string &name, const rmqt::ExchangeType &exchangeType=rmqt::ExchangeType::DIRECT, rmqt::AutoDelete::Value=rmqt::AutoDelete::OFF, rmqt::Durable::Value=rmqt::Durable::ON, rmqt::Internal::Value=rmqt::Internal::NO, const rmqt::FieldTable &args=rmqt::FieldTable()) BSLS_KEYWORD_OVERRIDE
Declare an exchange.
Definition: rmqa_topology.cpp:74
rmqt::ExchangeHandle addPassiveExchange(const bsl::string &name) BSLS_KEYWORD_OVERRIDE
Declare a dependency on an existing Exchange. If the exchange isn't already declared on the server,...
Definition: rmqa_topology.cpp:115
const rmqt::ExchangeHandle defaultExchange() BSLS_KEYWORD_OVERRIDE
Retrieve a handle for the default exchange.
Definition: rmqa_topology.cpp:149
const rmqt::Topology & topology() const BSLS_KEYWORD_OVERRIDE
Get a readonly copy of stored topology.
Definition: rmqa_topology.cpp:147
void bind(const rmqt::ExchangeHandle &exchangeName, const rmqt::QueueHandle &queue, const bsl::string &bindingKey, const rmqt::FieldTable &args=rmqt::FieldTable()) BSLS_KEYWORD_OVERRIDE
Bind a queue and an exchange.
Definition: rmqa_topology.cpp:125
An interface providing a manipulatable RabbitMQ topology structure.
Definition: rmqp_topology.h:39
AMQP Exchange types.
Definition: rmqt_exchangetype.h:27
Definition: rmqt_topology.h:32
Represents AMQP 0.9.1 Field Table (dict of FieldValues)
Definition: rmqt_fieldvalue.h:108