userver: samples/kafka_service/src/producer_handler.hpp
Loading...
Searching...
No Matches
samples/kafka_service/src/producer_handler.hpp
#pragma once
#include <string_view>
#include <userver/kafka/producer.hpp>
namespace kafka_sample {
class ProducerHandler final : public server::handlers::HttpHandlerJsonBase {
public:
static constexpr std::string_view kName{"producer-handler"};
ProducerHandler(const components::ComponentConfig& config, const components::ComponentContext& context);
formats::json::Value HandleRequestJsonThrow(
const server::http::HttpRequest& request,
const formats::json::Value& request_json,
) const override;
private:
const kafka::Producer& producer_;
};
} // namespace kafka_sample