userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
consumer_scope.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <functional>
7
8
#include <
userver/kafka/message.hpp
>
9
#include <
userver/kafka/offset_range.hpp
>
10
#include <
userver/kafka/rebalance_types.hpp
>
11
#include <
userver/utils/zstring_view.hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
kafka {
16
17
namespace
impl {
18
19
class
Consumer;
20
21
}
// namespace impl
22
68
class
ConsumerScope final {
69
public
:
76
using
Callback
= std::function<void(MessageBatchView)>;
77
79
~ConsumerScope
();
80
81
ConsumerScope(ConsumerScope&&) noexcept = delete;
82
ConsumerScope& operator=(ConsumerScope&&) noexcept = delete;
83
85
const
std
::vector<
std
::
string
>&
GetTopics
() const;
86
94
void
Start
(
Callback
callback);
95
110
void
Stop
() noexcept;
111
121
void
AsyncCommit
();
122
132
OffsetRange
GetOffsetRange
(
133
utils
::zstring_view topic,
134
std
::uint32_t partition,
135
std
::optional<
std
::chrono::milliseconds> timeout =
std
::nullopt
136
) const;
137
146
std
::vector<
std
::uint32_t>
GetPartitionIds
(
147
utils
::zstring_view topic,
148
std
::optional<
std
::chrono::milliseconds> timeout =
std
::nullopt
149
) const;
150
156
void
SetRebalanceCallback
(
ConsumerRebalanceCallback
rebalance_callback);
157
163
void
ResetRebalanceCallback
();
164
178
void
Seek
(
179
utils
::zstring_view topic,
180
std
::uint32_t partition_id,
181
std
::uint64_t offset,
182
std
::chrono::milliseconds timeout
183
) const;
184
196
void
SeekToBeginning
(
utils
::zstring_view topic,
std
::uint32_t partition_id,
std
::chrono::milliseconds timeout)
197
const;
198
210
void
SeekToEnd
(
utils
::zstring_view topic,
std
::uint32_t partition_id,
std
::chrono::milliseconds timeout) const;
211
212
private:
213
friend class impl::Consumer;
214
215
explicit ConsumerScope(impl::Consumer& consumer) noexcept;
216
217
impl::Consumer& consumer_;
218
};
219
220
}
// namespace kafka
221
222
USERVER_NAMESPACE_END
userver
kafka
consumer_scope.hpp
Generated on
for userver by
Doxygen
1.17.0