userver: components::RabbitMQ Class Reference
Loading...
Searching...
No Matches
components::RabbitMQ Class Reference

#include <userver/urabbitmq/component.hpp>

Detailed Description

RabbitMQ (AMQP 0.9.1) client component.

Provides access to a RabbitMQ cluster.

Static configuration example:

# yaml
my-rabbit:
secdist_alias: my-rabbit-alias
min_pool_size: 5
max_pool_size: 10
max_in_flight_requests: 5
use_secure_connection: false

If the component is configured with an secdist_alias, it will lookup connection data in secdist.json via secdist_alias value, otherwise via components name.

Secdist format

A RabbitMQ alias in secdist is described as a JSON object 'rabbitmq_settings', containing descriptions of RabbitMQ clusters.

# json
'rabbitmq_settings': {
'my-rabbit-alias': {
'hosts': ['localhost'],
'port': 8672,
'login': 'guest',
'password': 'guest',
'vhost': '/',
},
},

Static options:

Name Description Default value
secdist_alias name of the key in secdist config components name
min_pool_size minimum connections pool size (per host) 5
max_pool_size maximum connections pool size (per host, consumers excluded) 10
max_in_flight_requests per-connection limit for requests awaiting response from the broker 5
use_secure_connection whether to use TLS for connections true

Definition at line 57 of file component.hpp.

+ Inheritance diagram for components::RabbitMQ:
+ Collaboration diagram for components::RabbitMQ:

Public Member Functions

 RabbitMQ (const ComponentConfig &config, const ComponentContext &context)
 Component constructor.
 
 ~RabbitMQ () override
 Component destructor.
 
std::shared_ptr< urabbitmq::ClientGetClient () const
 Cluster accessor.
 
- Public Member Functions inherited from components::LoggableComponentBase
 LoggableComponentBase (const ComponentConfig &, const ComponentContext &)
 
 LoggableComponentBase (LoggableComponentBase &&)=delete
 
 LoggableComponentBase (const LoggableComponentBase &)=delete
 
 ~LoggableComponentBase () override=default
 
ComponentHealth GetComponentHealth () const override
 
void OnLoadingCancelled () override
 
void OnAllComponentsLoaded () override
 
void OnAllComponentsAreStopping () override
 

Static Public Member Functions

static yaml_config::Schema GetStaticConfigSchema ()
 
- Static Public Member Functions inherited from components::LoggableComponentBase
static yaml_config::Schema GetStaticConfigSchema ()
 

The documentation for this class was generated from the following file: