userver
C++ Async Framework
Loading...
Searching...
No Matches
client_settings.hpp
1
#
pragma
once
2
3
#
include
<
cstddef
>
4
#
include
<
string
>
5
#
include
<
unordered_map
>
6
#
include
<
vector
>
7
8
#
include
<
userver
/
components
/
component_config
.
hpp
>
9
#
include
<
userver
/
formats
/
json_fwd
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
urabbitmq {
14
15
struct
EndpointInfo
final
{
16
/// RabbitMQ node address (either FQDN or ip)
17
std::string
host
=
"localhost"
;
18
19
/// Port to connect to
20
uint16_t
port
= 5672;
21
};
22
23
struct
AuthSettings
final
{
24
/// Login to use
25
std::string
login
=
"guest"
;
26
27
/// Password to use
28
std::string
password
=
"guest"
;
29
30
/// RabbitMQs vhost
31
std::string
vhost
=
"/"
;
32
};
33
34
struct
RabbitEndpoints
final
{
35
/// Auth settings
36
AuthSettings
auth
{};
37
38
/// Endpoints to connect to
39
std
::
vector
<
EndpointInfo
>
endpoints
{};
40
};
41
42
struct
PoolSettings
final
{
43
/// Library will try to maintain at least this amount of connections.
44
/// Note that every consumer takes a connection for himself and this limit
45
/// doesn't account that
46
size_t
min_pool_size
= 5;
47
48
/// Library will maintain at most this amount of connections.
49
/// Note that every consumer takes a connection for himself and this limit
50
/// doesn't account that
51
size_t
max_pool_size
= 10;
52
53
/// A per-connection limit for concurrent requests waiting
54
/// for response from the broker.
55
/// Note: increasing this allows one to potentially increase throughput,
56
/// but in case of a connection-wide error
57
/// (tcp error/protocol error/write timeout) leads to a errors burst:
58
/// all outstanding request will fails at once
59
size_t
max_in_flight_requests
= 5;
60
};
61
62
class
TestsHelper;
63
struct
ClientSettings
final
{
64
/// Per-host connections pool settings
65
PoolSettings
pool_settings
{};
66
67
/// Endpoints settings
68
RabbitEndpoints
endpoints
{};
69
70
/// Whether to use TLS for connections
71
bool
use_secure_connection
=
true
;
72
73
ClientSettings(
const
components
::ComponentConfig& config,
74
const
RabbitEndpoints& rabbit_endpoints);
75
76
private
:
77
friend
class
TestsHelper;
78
ClientSettings();
79
};
80
81
class
RabbitEndpointsMulti
final
{
82
public
:
83
RabbitEndpointsMulti(
const
formats::
json
::Value& doc);
84
85
const
RabbitEndpoints& Get(
const
std::string& name)
const
;
86
87
private
:
88
std::unordered_map<std::string, RabbitEndpoints> endpoints_;
89
};
90
91
}
// namespace urabbitmq
92
93
USERVER_NAMESPACE_END
userver
urabbitmq
client_settings.hpp
Generated on Wed May 15 2024 22:30:49 for userver by
Doxygen
1.10.0