RMQ - RabbitMQ C++ Library
rmqa_rabbitcontext.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_RABBITCONTEXT
17#define INCLUDED_RMQA_RABBITCONTEXT
18
19#include <rmqa_rabbitcontextoptions.h>
20#include <rmqa_topology.h>
21#include <rmqa_vhost.h>
22
23#include <rmqp_metricpublisher.h>
24#include <rmqp_rabbitcontext.h>
25#include <rmqp_topology.h>
26
27#include <rmqt_credentials.h>
28#include <rmqt_endpoint.h>
29#include <rmqt_future.h>
30#include <rmqt_vhostinfo.h>
31
32#include <bdlmt_threadpool.h>
33
34#include <bsl_memory.h>
35#include <bsl_string.h>
36
37namespace BloombergLP {
38namespace rmqa {
39class RabbitContextImpl;
40
47
49 public:
50 // CREATORS
55 explicit RabbitContext(
57
62 explicit RabbitContext(bslma::ManagedPtr<rmqp::RabbitContext> impl);
63
69
78 bsl::shared_ptr<VHost> createVHostConnection(
79 const bsl::string& userDefinedName,
80 const bsl::shared_ptr<rmqt::Endpoint>& endpoint,
81 const bsl::shared_ptr<rmqt::Credentials>& credentials);
82
91 bsl::shared_ptr<VHost>
92 createVHostConnection(const bsl::string& userDefinedName,
93 const rmqt::VHostInfo& vhostInfo);
94
95 private:
96 bslma::ManagedPtr<rmqp::RabbitContext> d_impl;
97
98 private:
99 RabbitContext(const RabbitContext&) BSLS_KEYWORD_DELETED;
100 RabbitContext& operator=(const RabbitContext&) BSLS_KEYWORD_DELETED;
101
102}; // class RabbitContext
103
104} // namespace rmqa
105} // namespace BloombergLP
106
107#endif // ! INCLUDED_RMQA_RABBITCONTEXT
Class for passing arguments to RabbitContext.
Definition: rmqa_rabbitcontextoptions.h:42
Owns resources shared between multiple RabbitMQ connections.
Definition: rmqa_rabbitcontext.h:48
RabbitContext(const RabbitContextOptions &options=RabbitContextOptions())
Construct a RabbitContext.
Definition: rmqa_rabbitcontext.cpp:39
bsl::shared_ptr< VHost > createVHostConnection(const bsl::string &userDefinedName, const bsl::shared_ptr< rmqt::Endpoint > &endpoint, const bsl::shared_ptr< rmqt::Credentials > &credentials)
Connect to a RabbitMQ broker.
Definition: rmqa_rabbitcontext.cpp:53
~RabbitContext()
Definition: rmqa_rabbitcontext.cpp:51
Holds the VHost endpoint and credentials, used to connect.
Definition: rmqt_vhostinfo.h:28