pub struct Client { /* private fields */ }
Expand description
A Kafka client.
This client is Send + Sync + Clone
, and cloning this client to share it among application
tasks is encouraged.
This client spawns a task which manages the full lifecycle of interaction with a Kafka cluster, include initial broker connections based on seed list, cluster metadata discovery, connections to new brokers, establish API versions of brokers, handling reconnects, and anything else related to maintain connections to a Kafka cluster.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn get_metadata(
&self,
broker_id: i32,
) -> ClientResult<MetadataResponse>
pub async fn get_metadata( &self, broker_id: i32, ) -> ClientResult<MetadataResponse>
Get cluster metadata from the broker specified by ID.
Sourcepub async fn list_offsets(
&self,
topic: StrBytes,
ptn: i32,
pos: ListOffsetsPosition,
) -> ClientResult<i64>
pub async fn list_offsets( &self, topic: StrBytes, ptn: i32, pos: ListOffsetsPosition, ) -> ClientResult<i64>
List topic partition offsets.
Sourcepub async fn fetch(
&self,
topic: StrBytes,
ptn: i32,
start: i64,
) -> ClientResult<Option<Vec<Record>>>
pub async fn fetch( &self, topic: StrBytes, ptn: i32, start: i64, ) -> ClientResult<Option<Vec<Record>>>
Fetch a batch of records from the target topic partition.
Sourcepub async fn find_coordinator(
&self,
key: StrBytes,
key_type: i8,
broker_id: Option<i32>,
) -> ClientResult<FindCoordinatorResponse>
pub async fn find_coordinator( &self, key: StrBytes, key_type: i8, broker_id: Option<i32>, ) -> ClientResult<FindCoordinatorResponse>
Find the coordinator for the given group.
Sourcepub fn topic_producer(
&self,
topic: &str,
acks: Acks,
timeout_ms: Option<i32>,
compression: Option<Compression>,
) -> TopicProducer
pub fn topic_producer( &self, topic: &str, acks: Acks, timeout_ms: Option<i32>, compression: Option<Compression>, ) -> TopicProducer
Build a producer for a topic.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more