pub struct ResilientClient { /* private fields */ }Expand description
Production-grade resilient client with connection pooling and fault tolerance
Implementations§
Source§impl ResilientClient
impl ResilientClient
Sourcepub async fn new(config: ResilientClientConfig) -> Result<Self>
pub async fn new(config: ResilientClientConfig) -> Result<Self>
Create a new resilient client
Sourcepub async fn publish(
&self,
topic: impl Into<String>,
value: impl Into<Bytes>,
) -> Result<u64>
pub async fn publish( &self, topic: impl Into<String>, value: impl Into<Bytes>, ) -> Result<u64>
Publish a message to a topic with automatic retries
Sourcepub async fn publish_with_key(
&self,
topic: impl Into<String>,
key: Option<impl Into<Bytes>>,
value: impl Into<Bytes>,
) -> Result<u64>
pub async fn publish_with_key( &self, topic: impl Into<String>, key: Option<impl Into<Bytes>>, value: impl Into<Bytes>, ) -> Result<u64>
Publish a message with a key
Sourcepub async fn consume(
&self,
topic: impl Into<String>,
partition: u32,
offset: u64,
max_messages: usize,
) -> Result<Vec<MessageData>>
pub async fn consume( &self, topic: impl Into<String>, partition: u32, offset: u64, max_messages: usize, ) -> Result<Vec<MessageData>>
Consume messages with automatic retries
Sourcepub async fn create_topic(
&self,
name: impl Into<String>,
partitions: Option<u32>,
) -> Result<u32>
pub async fn create_topic( &self, name: impl Into<String>, partitions: Option<u32>, ) -> Result<u32>
Create a topic with automatic retries
Sourcepub async fn list_topics(&self) -> Result<Vec<String>>
pub async fn list_topics(&self) -> Result<Vec<String>>
List all topics
Sourcepub async fn commit_offset(
&self,
consumer_group: impl Into<String>,
topic: impl Into<String>,
partition: u32,
offset: u64,
) -> Result<()>
pub async fn commit_offset( &self, consumer_group: impl Into<String>, topic: impl Into<String>, partition: u32, offset: u64, ) -> Result<()>
Commit consumer offset
Sourcepub async fn get_offset(
&self,
consumer_group: impl Into<String>,
topic: impl Into<String>,
partition: u32,
) -> Result<Option<u64>>
pub async fn get_offset( &self, consumer_group: impl Into<String>, topic: impl Into<String>, partition: u32, ) -> Result<Option<u64>>
Get consumer offset
Sourcepub async fn get_offset_bounds(
&self,
topic: impl Into<String>,
partition: u32,
) -> Result<(u64, u64)>
pub async fn get_offset_bounds( &self, topic: impl Into<String>, partition: u32, ) -> Result<(u64, u64)>
Get offset bounds (earliest, latest)
Sourcepub async fn get_metadata(
&self,
topic: impl Into<String>,
) -> Result<(String, u32)>
pub async fn get_metadata( &self, topic: impl Into<String>, ) -> Result<(String, u32)>
Get topic metadata
Sourcepub fn stats(&self) -> ClientStats
pub fn stats(&self) -> ClientStats
Get client statistics
Auto Trait Implementations§
impl !Freeze for ResilientClient
impl !RefUnwindSafe for ResilientClient
impl Send for ResilientClient
impl Sync for ResilientClient
impl Unpin for ResilientClient
impl !UnwindSafe for ResilientClient
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