1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! Subscribe-style consumer client for Apache Kafka in Rust.
//!
//! Builds on `crabka-client-core` for transport; adds the classic
//! consumer-group lifecycle (`JoinGroup` → `SyncGroup` → `Heartbeat` →
//! `Fetch` → `OffsetCommit` → `LeaveGroup`) and a built-in heartbeat
//! task.
//!
//! ## Quick start
//!
//! ```no_run
//! use std::time::Duration;
//! use crabka_client_consumer::{Consumer, AutoOffsetReset};
//!
//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
//! let mut consumer = Consumer::builder()
//! .bootstrap("localhost:9092")
//! .group_id("my-group")
//! .client_id("my-app")
//! .auto_offset_reset(AutoOffsetReset::Earliest)
//! .subscribe(["my-topic".to_string()])
//! .build()
//! .await?;
//!
//! loop {
//! let records = consumer.poll(Duration::from_millis(500)).await?;
//! for _r in records {
//! // ... handle r ...
//! }
//! consumer.commit_sync().await?;
//! }
//! # }
//! ```
//!
//! ## Share-group consumption
//!
//! ```no_run
//! use std::time::Duration;
//! use crabka_client_consumer::{ShareAckMode, ShareAckType, ShareConsumer};
//!
//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
//! let mut consumer = ShareConsumer::builder()
//! .bootstrap("localhost:9092")
//! .group_id("share-workers")
//! .subscribe(["jobs".to_string()])
//! .ack_mode(ShareAckMode::Explicit)
//! .build()
//! .await?;
//!
//! let records = consumer.poll(Duration::from_secs(1)).await?;
//! for record in &records {
//! consumer.acknowledge(record, ShareAckType::Accept)?;
//! }
//! consumer.commit().await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Capabilities and boundaries
//!
//! This crate owns consumer-facing semantics: classic group membership,
//! assignment, fetch/poll, offset commit, cooperative shutdown, and KIP-932
//! share-group consumption. It intentionally does not duplicate admin-client
//! surfaces such as `DescribeGroups`/`ListGroups`, and manual partition fetches
//! remain available through the lower-level helpers in `crabka-client-core`.
//! Transactional consume-process-produce workflows use this crate's
//! [`ConsumerGroupMetadata`] together with `crabka-client-producer`'s
//! `send_offsets_to_transaction` support.
//!
//! ## Cargo features
//!
//! None for now.
pub use Assignor;
pub use ;
pub use ;
pub use ConsumerError;
pub use ConsumerGroupMetadata;
pub use ;