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
//! Async Kafka client built on top of the tokio runtime.
//!
//! This crate provides native asynchronous Kafka clients built on tokio.
//! It exposes three primary types:
//!
//! - [`AsyncKafkaClient`]: bootstrap and connection management for async code.
//! - [`AsyncProducer`]: an async producer using non-blocking Kafka protocol I/O.
//! - [`AsyncProducerBuilder`]: async builder for configuring and creating an
//! `AsyncProducer` without blocking the tokio scheduler.
//! - [`AsyncConsumer`]: an async consumer using non-blocking Kafka protocol I/O.
//! - [`AsyncConsumerBuilder`]: async builder for configuring and creating an
//! `AsyncConsumer` without blocking the tokio scheduler.
//!
//! # Example
//!
//! ```no_run
//! use rustfs_kafka_async::{AsyncKafkaClient, AsyncProducer};
//! use rustfs_kafka::producer::Record;
//!
//! #[tokio::main]
//! async fn main() -> rustfs_kafka::error::Result<()> {
//! // Create an async client from bootstrap hosts
//! let client = AsyncKafkaClient::new(vec!["localhost:9092".to_owned()]).await?;
//! // Create an async producer which manages a background task
//! let mut producer = AsyncProducer::new(client).await?;
//!
//! // Send a single message and close the producer
//! producer.send(&Record::from_value("test-topic", &b"hello"[..])).await?;
//! producer.close().await?;
//! Ok(())
//! }
//! ```
pub use AsyncKafkaClient;
pub use ;
pub use ;
// Re-export core types from the sync crate for convenience
pub use ;
pub use error;
pub use ;