userver
C++ Async Framework
Loading...
Searching...
No Matches
producer_component.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/kafka/producer_component.hpp
4
/// @brief @copybrief kafka::ProducerComponent
5
6
#
include
<
string_view
>
7
8
#
include
<
userver
/
kafka
/
producer
.
hpp
>
9
10
#
include
<
userver
/
components
/
component_base
.
hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
kafka {
15
16
/// @ingroup userver_components
17
///
18
/// @brief Apache Kafka Producer client component.
19
///
20
/// ## Static configuration example:
21
///
22
/// @snippet samples/kafka_service/static_config.yaml Kafka service sample - producer static config
23
///
24
/// ## Secdist format
25
///
26
/// A Kafka alias in secdist is described as a JSON object
27
/// `kafka_settings`, containing credentials of Kafka brokers.
28
///
29
/// @snippet samples/kafka_service/testsuite/conftest.py Kafka service sample - secdist
30
///
31
/// ## Static options of kafka::ProducerComponent:
32
/// @include{doc} scripts/docs/en/components_schema/kafka/src/kafka/producer_component.md
33
///
34
/// Options inherited from @ref components::ComponentBase :
35
/// @include{doc} scripts/docs/en/components_schema/core/src/components/impl/component_base.md
36
class
ProducerComponent
final
:
public
components
::
ComponentBase
{
37
public
:
38
/// @ingroup userver_component_names
39
/// @brief The default name of kafka::ProducerComponent component
40
static
constexpr
std::string_view
kName
{
"kafka-producer"
};
41
42
ProducerComponent(
const
components
::ComponentConfig& config,
const
components
::ComponentContext& context);
43
~ProducerComponent()
override
;
44
45
/// @brief Returns a producer instance reference.
46
/// @see kafka::Producer
47
const
Producer&
GetProducer
();
48
49
static
yaml_config::Schema GetStaticConfigSchema();
50
51
private
:
52
Producer producer_;
53
};
54
55
}
// namespace kafka
56
57
USERVER_NAMESPACE_END
userver
kafka
producer_component.hpp
Generated on Thu May 21 2026 16:21:02 for userver by
Doxygen
1.13.2