Struct sea_streamer_kafka::KafkaConsumer

source ยท
pub struct KafkaConsumer { /* private fields */ }

Implementationsยง

sourceยง

impl KafkaConsumer

source

pub fn inner(&mut self) -> &RawConsumer

Borrow the inner KafkaConsumer. Use at your own risk.

source

pub fn stream_shards(&self) -> &[(StreamKey, ShardId)]

Stream-shards this consumer has been (manually) assigned to. Note that since this can be changing due to load-balancing, only ZERO is assigned by default.

source

pub async fn reassign_partitions(&mut self) -> KafkaResult<()>

Fetch the partition list of subscribed topics and assign all partitions.

source

pub async fn commit_message( &mut self, mess: &KafkaMessage<'_> ) -> KafkaResult<()>

Commit an โ€œackโ€ to broker for having processed this message.

ยงWarning

This async method is not cancel safe. You must await this future, and this Consumer will be unusable for any operations until it finishes.

source

pub async fn commit_with( &mut self, __arg1: &(StreamKey, ShardId, SeqNo) ) -> KafkaResult<()>

Commit an โ€œackโ€ to broker for having processed up to this cursor.

ยงWarning

This async method is not cancel safe. You must await this future, and this Consumer will be unusable for any operations until it finishes.

source

pub async fn commit( &mut self, stream: &StreamKey, shard: &ShardId, seq: &SeqNo ) -> KafkaResult<()>

Commit an โ€œackโ€ to broker for having processed up to this cursor.

ยงWarning

This async method is not cancel safe. You must await this future, and this Consumer will be unusable for any operations until it finishes.

source

pub fn store_offset( &mut self, stream: &StreamKey, shard: &ShardId, seq: &SeqNo ) -> KafkaResult<()>

Store the offset so that it will be committed. You must have set_enable_auto_offset_store to false.

source

pub fn store_offset_for_message( &mut self, mess: &KafkaMessage<'_> ) -> KafkaResult<()>

Store the offset for this message so that it will be committed. You must have set_enable_auto_offset_store to false.

source

pub fn store_offset_with( &mut self, (stream_key, shard_id, sequence): &(StreamKey, ShardId, SeqNo) ) -> KafkaResult<()>

Store the offset with message identifier so that it will be committed. You must have set_enable_auto_offset_store to false.

Trait Implementationsยง

sourceยง

impl Consumer for KafkaConsumer

sourceยง

async fn seek(&mut self, timestamp: Timestamp) -> KafkaResult<()>

Seek all streams to the given point in time, with all partitions assigned.

ยงWarning

This async method is not cancel safe. You must await this future, and this Consumer will be unusable for any operations until it finishes.

sourceยง

async fn rewind(&mut self, offset: SeqPos) -> KafkaResult<()>

Rewind all streams across all assigned partitions. Call Consumer::assign to assign a partition beforehand, or KafkaConsumer::reassign_partitions to assign all partitions.

sourceยง

fn stream<'a, 'b: 'a>(&'b mut self) -> Self::Stream<'a>

Note: Kafka stream never ends.

ยง

type Error = KafkaError

ยง

type Message<'a> = KafkaMessage<'a>

ยง

type NextFuture<'a> = Map<StreamFuture<MessageStream<'a, DefaultConsumerContext>>, fn(_: (Option<Result<BorrowedMessage<'a>, KafkaError>>, MessageStream<'a, DefaultConsumerContext>)) -> Result<KafkaMessage<'a>, StreamErr<KafkaError>>>

ยง

type Stream<'a> = Map<MessageStream<'a, DefaultConsumerContext>, fn(_: Result<BorrowedMessage<'a>, KafkaError>) -> Result<KafkaMessage<'a>, StreamErr<KafkaError>>>

sourceยง

fn assign(&mut self, (stream, shard): (StreamKey, ShardId)) -> KafkaResult<()>

Assign this consumer to a particular shard. Can be called multiple times to assign to multiple shards. Returns error StreamKeyNotFound if the stream is not currently subscribed. Read more
sourceยง

fn unassign(&mut self, s: (StreamKey, ShardId)) -> KafkaResult<()>

Unassign a shard. Returns error StreamKeyNotFound if the stream is not currently subscribed. Returns error StreamKeyEmpty if all streams have been unassigned.
sourceยง

fn next(&self) -> Self::NextFuture<'_>

Poll and receive one message: it awaits until there are new messages. This method can be called from multiple threads.
sourceยง

impl Debug for KafkaConsumer

sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementationsยง

Blanket Implementationsยง

sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
sourceยง

impl<T> From<T> for T

sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

ยง

type Error = Infallible

The type returned in the event of a conversion error.
sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

ยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.