5#include <userver/kafka/message.hpp>
6#include <userver/kafka/offset_range.hpp>
7#include <userver/kafka/rebalance_types.hpp>
8#include <userver/utils/zstring_view.hpp>
10USERVER_NAMESPACE_BEGIN
70class ConsumerScope
final {
76 using Callback = std::function<
void(MessageBatchView)>;
81 ConsumerScope(ConsumerScope&&)
noexcept =
delete;
82 ConsumerScope& operator=(ConsumerScope&&)
noexcept =
delete;
85 const std::vector<std::string>&
GetTopics()
const;
94 void Start(Callback callback);
110 void Stop()
noexcept;
133 utils::zstring_view topic,
134 std::uint32_t partition,
135 std::optional<std::chrono::milliseconds> timeout = std::nullopt
147 utils::zstring_view topic,
148 std::optional<std::chrono::milliseconds> timeout = std::nullopt
179 utils::zstring_view topic,
180 std::uint32_t partition_id,
181 std::uint64_t offset,
182 std::chrono::milliseconds timeout
196 void SeekToBeginning(utils::zstring_view topic, std::uint32_t partition_id, std::chrono::milliseconds timeout)
210 void SeekToEnd(utils::zstring_view topic, std::uint32_t partition_id, std::chrono::milliseconds timeout)
const;
213 friend class impl::Consumer;
215 explicit ConsumerScope(impl::Consumer& consumer)
noexcept;
217 impl::Consumer& consumer_;