Struct sea_streamer_kafka::KafkaConsumer
source ยท pub struct KafkaConsumer { /* private fields */ }
Implementationsยง
sourceยงimpl KafkaConsumer
impl KafkaConsumer
sourcepub fn inner(&mut self) -> &RawConsumer
pub fn inner(&mut self) -> &RawConsumer
Borrow the inner KafkaConsumer. Use at your own risk.
sourcepub fn stream_shards(&self) -> &[(StreamKey, ShardId)]
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.
sourcepub async fn reassign_partitions(&mut self) -> KafkaResult<()>
pub async fn reassign_partitions(&mut self) -> KafkaResult<()>
Fetch the partition list of subscribed topics and assign all partitions.
sourcepub async fn commit_message(
&mut self,
mess: &KafkaMessage<'_>
) -> KafkaResult<()>
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.
sourcepub async fn commit_with(
&mut self,
__arg1: &(StreamKey, ShardId, SeqNo)
) -> KafkaResult<()>
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.
sourcepub async fn commit(
&mut self,
stream: &StreamKey,
shard: &ShardId,
seq: &SeqNo
) -> KafkaResult<()>
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.
sourcepub fn store_offset(
&mut self,
stream: &StreamKey,
shard: &ShardId,
seq: &SeqNo
) -> KafkaResult<()>
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.
sourcepub fn store_offset_for_message(
&mut self,
mess: &KafkaMessage<'_>
) -> KafkaResult<()>
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.
sourcepub fn store_offset_with(
&mut self,
(stream_key, shard_id, sequence): &(StreamKey, ShardId, SeqNo)
) -> KafkaResult<()>
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
impl Consumer for KafkaConsumer
sourceยงasync fn seek(&mut self, timestamp: Timestamp) -> KafkaResult<()>
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<()>
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.
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<()>
fn assign(&mut self, (stream, shard): (StreamKey, ShardId)) -> KafkaResult<()>
StreamKeyNotFound
if the stream is not currently subscribed. Read moresourceยงfn unassign(&mut self, s: (StreamKey, ShardId)) -> KafkaResult<()>
fn unassign(&mut self, s: (StreamKey, ShardId)) -> KafkaResult<()>
StreamKeyNotFound
if the stream is not currently subscribed.
Returns error StreamKeyEmpty
if all streams have been unassigned.