6#include <userver/engine/task/task.hpp>
7#include <userver/engine/task/task_processor_fwd.hpp>
8#include <userver/engine/task/task_with_result.hpp>
9#include <userver/utils/statistics/writer.hpp>
11USERVER_NAMESPACE_BEGIN
20struct ProducerConfiguration;
28struct ProducerExecutionParams
final {
76 engine::TaskProcessor& producer_task_processor,
77 const impl::ProducerConfiguration& configuration,
78 const impl::Secret& secrets, ProducerExecutionParams params);
84 Producer(
const Producer&) =
delete;
85 Producer(Producer&&) =
delete;
87 Producer& operator=(
const Producer&) =
delete;
88 Producer& operator=(Producer&&) =
delete;
111 void Send(
const std::string& topic_name, std::string_view key,
112 std::string_view message,
113 std::optional<std::uint32_t> partition =
std::
nullopt)
const;
124 std::string topic_name, std::string key, std::string message,
125 std::optional<std::uint32_t> partition =
std::
nullopt)
const;
129 void DumpMetric(utils::statistics::Writer& writer)
const;
132 void InitProducerAndStartPollingIfFirstSend()
const;
134 void VerifyNotFinished()
const;
137 void SendToTestPoint(std::string_view topic_name, std::string_view key,
138 std::string_view message)
const;
141 void ExtendCurrentSpan()
const;
144 const std::string component_name_;
145 engine::TaskProcessor& producer_task_processor_;
147 const std::chrono::milliseconds poll_timeout_{};
148 const std::size_t send_retries_{};
150 mutable std::atomic<
bool> first_send_{
true};
151 mutable std::unique_ptr<impl::Configuration> configuration_;
152 mutable std::unique_ptr<impl::ProducerImpl>
154 mutable engine::
Task poll_task_;