userver
C++ Async Framework
Loading...
Searching...
No Matches
rebalance_types.hpp
1
#
pragma
once
2
3
#
include
<
cstdint
>
4
#
include
<
functional
>
5
#
include
<
optional
>
6
7
#
include
<
userver
/
utils
/
span
.
hpp
>
8
#
include
<
userver
/
utils
/
zstring_view
.
hpp
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
kafka {
13
14
enum
class
RebalanceEventType { kAssigned, kRevoked };
15
16
/// @brief Represents the topic's partition for certain topic.
17
struct
TopicPartitionView
final
{
18
/// @brief Topic's name.
19
utils
::
zstring_view
topic
;
20
21
/// @brief Partition ID for a topic
22
std::
uint32_t
partition_id
;
23
24
/// @brief Offset for current partition if it has commited offset
25
std::optional<std::
uint64_t
>
offset
;
26
27
TopicPartitionView(
utils
::
zstring_view
topic, std::uint32_t partition_id, std::optional<std::uint64_t> offset)
28
:
topic
{topic},
partition_id
{partition_id},
offset
{offset} {}
29
};
30
31
using
TopicPartitionBatchView =
utils
::span<
const
TopicPartitionView>;
32
33
/// @brief Callback invoked when a rebalance event occurs.
34
/// @warning The rebalance callback should be set before calling ConsumerScope::Start or after ConsumerScope::Stop.
35
/// The callback must not throw exceptions; any thrown exceptions will be caught and logged by the consumer
36
/// implementation.
37
/// @note The callback is invoked after the assign or revoke event has been successfully processed.
38
using
ConsumerRebalanceCallback = std::function<
void
(TopicPartitionBatchView, RebalanceEventType)>;
39
40
}
// namespace kafka
41
42
USERVER_NAMESPACE_END
userver
kafka
rebalance_types.hpp
Generated on Tue Sep 2 2025 12:38:18 for userver by
Doxygen
1.13.2