pub struct MockConsumer<K, V> { /* private fields */ }Expand description
A mock of the Consumer interface you can use for testing code that
uses Kafka. This class is not threadsafe. However, you can use the
Self::schedule_poll_task method to write multithreaded tests where a
driver thread waits for Consumer::poll to be called by a background
thread and then can safely perform operations during a callback.
§Translation notes
The mock is Send but not Sync: another task reaches it through
Consumer::handle.
use confluent_kafka::consumer::MockConsumer;
fn assert_sync<T: Sync>() {}
assert_sync::<MockConsumer<String, String>>();Implementations§
Source§impl<K, V> MockConsumer<K, V>
impl<K, V> MockConsumer<K, V>
Sourcepub fn new(offset_reset_strategy: &str) -> Result<Self, Error>
pub fn new(offset_reset_strategy: &str) -> Result<Self, Error>
A mock consumer is instantiated by providing
ConsumerConfig::AUTO_OFFSET_RESET_CONFIG value as the input.
§Arguments
offset_reset_strategy- the offset reset strategy to use
§Returns
The new mock consumer.
§Errors
Error::is_local_illegal_argument_errorifoffset_reset_strategyis not a validauto.offset.resetvalue
Sourcepub fn add_record(&mut self, record: ConsumerRecord<K, V>) -> Result<(), Error>
pub fn add_record(&mut self, record: ConsumerRecord<K, V>) -> Result<(), Error>
Adds a record to be returned when Consumer::poll is called.
§Arguments
record- the record to add
§Errors
Error::is_local_illegal_state_errorif the partition is not assigned to the consumer
Sourcepub fn update_beginning_offsets(
&mut self,
offsets: HashMap<TopicPartition, i64>,
)
pub fn update_beginning_offsets( &mut self, offsets: HashMap<TopicPartition, i64>, )
Updates the beginning offsets for the specified partitions.
§Arguments
offsets- the beginning offsets to set
Sourcepub fn update_end_offsets(&mut self, offsets: HashMap<TopicPartition, i64>)
pub fn update_end_offsets(&mut self, offsets: HashMap<TopicPartition, i64>)
Sourcepub fn update_duration_offsets(&mut self, offsets: HashMap<TopicPartition, i64>)
pub fn update_duration_offsets(&mut self, offsets: HashMap<TopicPartition, i64>)
Updates the duration-based reset offsets for the specified partitions.
§Arguments
offsets- the duration offsets to set
Sourcepub fn update_partitions(
&mut self,
topic: &str,
partitions: Vec<PartitionInfo>,
) -> Result<(), Error>
pub fn update_partitions( &mut self, topic: &str, partitions: Vec<PartitionInfo>, ) -> Result<(), Error>
Sourcepub fn set_poll_error(&mut self, error: Option<Error>)
pub fn set_poll_error(&mut self, error: Option<Error>)
Sets an exception to throw when Consumer::poll is called.
§Arguments
error- the exception to throw;Noneclears a pending one
Sourcepub fn set_offsets_error(&mut self, error: Option<Error>)
pub fn set_offsets_error(&mut self, error: Option<Error>)
Sets an exception to throw when offset-related methods are called.
§Arguments
error- the exception to throw;Noneclears a pending one
Sourcepub fn set_max_poll_records(
&mut self,
max_poll_records: i64,
) -> Result<(), Error>
pub fn set_max_poll_records( &mut self, max_poll_records: i64, ) -> Result<(), Error>
Sets the maximum number of records returned in a single call to
Consumer::poll.
§Arguments
max_poll_records- the max.poll.records.
§Errors
Error::is_local_illegal_argument_errorifmax_poll_recordsis less than 1
Sourcepub fn rebalance(
&mut self,
new_assignment: &[TopicPartition],
) -> impl Future<Output = Result<(), Error>> + Send
pub fn rebalance( &mut self, new_assignment: &[TopicPartition], ) -> impl Future<Output = Result<(), Error>> + Send
Sourcepub fn lose_partitions(
&mut self,
partitions_lost: &[TopicPartition],
) -> impl Future<Output = Result<(), Error>> + Send
pub fn lose_partitions( &mut self, partitions_lost: &[TopicPartition], ) -> impl Future<Output = Result<(), Error>> + Send
Simulates a partition loss event. Calls
ConsumerRebalanceListener::on_partitions_lost for the specified
partitions and removes them from the current assignment. Unlike
Self::rebalance, which calls
ConsumerRebalanceListener::on_partitions_revoked, this method models
the case where the consumer loses partitions without a graceful revoke.
Only records belonging to the lost partitions are cleared; records for retained partitions are unaffected.
§Arguments
partitions_lost- the partitions to lose; all must be currently assigned
§Errors
Error::is_local_illegal_state_errorif any partition is not currently assigned- The error the listener returns; the assignment is then left unchanged.
Sourcepub fn schedule_poll_task(
&mut self,
task: Box<dyn FnOnce(&mut MockConsumer<K, V>) + Send>,
)
pub fn schedule_poll_task( &mut self, task: Box<dyn FnOnce(&mut MockConsumer<K, V>) + Send>, )
Schedule a task to be executed during a poll(). One enqueued task will
be executed per Consumer::poll invocation. You can use this
repeatedly to mock out multiple responses to poll invocations.
§Arguments
task- the task to be executed
§Translation notes
The task is called with the mock, &mut MockConsumer<K, V>, which a
Rust closure cannot capture.
Sourcepub fn schedule_nop_poll_task(&mut self)
pub fn schedule_nop_poll_task(&mut self)
Schedules a no-op task to be executed during a poll invocation.
Sourcepub fn should_rebalance(&self) -> bool
pub fn should_rebalance(&self) -> bool
Return whether an enforceRebalance request is pending.
§Returns
true if rebalance is pending, false otherwise
Sourcepub fn reset_should_rebalance(&mut self)
pub fn reset_should_rebalance(&mut self)
Resets the rebalance flag set by Consumer::enforce_rebalance.
Sourcepub fn last_poll_timeout(&self) -> Option<Duration>
pub fn last_poll_timeout(&self) -> Option<Duration>
Returns the timeout used in the last Consumer::poll call.
§Returns
the last poll timeout, or None if poll has not been called
Trait Implementations§
Source§impl<K, V> Consumer<K, V> for MockConsumer<K, V>
impl<K, V> Consumer<K, V> for MockConsumer<K, V>
Source§fn metrics(&self) -> MetricsView
fn metrics(&self) -> MetricsView
Returns an empty view: the mock keeps no metrics.
§Panics
Panics with "This consumer has already been closed." on a closed
mock, where Java’s ensureNotClosed() throws IllegalStateException:
calling it after close() is a programming error.
Source§async fn current_lag(
&mut self,
topic_partition: &TopicPartition,
) -> Result<Option<i64>, Error>
async fn current_lag( &mut self, topic_partition: &TopicPartition, ) -> Result<Option<i64>, Error>
Returns the end offset set by MockConsumer::update_end_offsets minus
the position, or 0 when no end offset was set.
§Arguments
topic_partition- The partition to get the lag for.
§Errors
- The error of
Consumer::position(a closed mock, an unassigned partition).
Source§fn assignment(&mut self) -> HashSet<TopicPartition>
fn assignment(&mut self) -> HashSet<TopicPartition>
Self::assign then this will simply return the same partitions that
were assigned. If topic subscription was used, then this will give the
set of topic partitions currently assigned to the consumer (which may
be none if the assignment hasn’t happened yet, or the partitions are in
the process of getting reassigned). Read moreSource§fn subscription(&mut self) -> HashSet<String>
fn subscription(&mut self) -> HashSet<String>
Self::subscribe_with_topics or
Self::subscribe_with_topics_listener, or an empty set if no such
call has been made. Read moreSource§fn paused(&mut self) -> HashSet<TopicPartition>
fn paused(&mut self) -> HashSet<TopicPartition>
Self::pause. Read moreSource§fn group_metadata(&mut self) -> Arc<dyn ConsumerGroupMetadata>
fn group_metadata(&mut self) -> Arc<dyn ConsumerGroupMetadata>
Source§async fn subscribe_with_topics(
&mut self,
topics: Vec<String>,
) -> Result<(), Error>
async fn subscribe_with_topics( &mut self, topics: Vec<String>, ) -> Result<(), Error>
Self::assign. If the given list of topics is
empty, it is treated the same as Self::unsubscribe. Read moreSource§async fn subscribe_with_topics_listener(
&mut self,
topics: Vec<String>,
listener: Arc<dyn ConsumerRebalanceListener>,
) -> Result<(), Error>
async fn subscribe_with_topics_listener( &mut self, topics: Vec<String>, listener: Arc<dyn ConsumerRebalanceListener>, ) -> Result<(), Error>
Self::assign. If the given list of
topics is empty, it is treated the same as Self::unsubscribe. Read moreSource§async fn subscribe_with_pattern(
&mut self,
pattern: SubscriptionPattern,
) -> Result<(), Error>
async fn subscribe_with_pattern( &mut self, pattern: SubscriptionPattern, ) -> Result<(), Error>
ConsumerConfig::GROUP_PROTOCOL_CONFIG) Read moreSource§async fn subscribe_with_pattern_listener(
&mut self,
pattern: SubscriptionPattern,
listener: Arc<dyn ConsumerRebalanceListener>,
) -> Result<(), Error>
async fn subscribe_with_pattern_listener( &mut self, pattern: SubscriptionPattern, listener: Arc<dyn ConsumerRebalanceListener>, ) -> Result<(), Error>
ConsumerConfig::GROUP_PROTOCOL_CONFIG). Read moreSource§async fn assign(&mut self, partitions: Vec<TopicPartition>) -> Result<(), Error>
async fn assign(&mut self, partitions: Vec<TopicPartition>) -> Result<(), Error>
Source§async fn unsubscribe(&mut self) -> Result<(), Error>
async fn unsubscribe(&mut self) -> Result<(), Error>
Self::subscribe_with_topics or Self::subscribe_with_pattern.
This also clears any partitions directly assigned through
Self::assign. Read moreSource§async fn poll(
&mut self,
timeout: Duration,
) -> Result<ConsumerRecords<K, V>, Error>
async fn poll( &mut self, timeout: Duration, ) -> Result<ConsumerRecords<K, V>, Error>
Source§async fn commit_sync(&mut self) -> Result<(), Error>
async fn commit_sync(&mut self) -> Result<(), Error>
Source§async fn commit_sync_with_timeout(
&mut self,
_timeout: Duration,
) -> Result<(), Error>
async fn commit_sync_with_timeout( &mut self, _timeout: Duration, ) -> Result<(), Error>
Source§async fn commit_sync_with_offsets(
&mut self,
offsets: HashMap<TopicPartition, OffsetAndMetadata>,
) -> Result<(), Error>
async fn commit_sync_with_offsets( &mut self, offsets: HashMap<TopicPartition, OffsetAndMetadata>, ) -> Result<(), Error>
Source§async fn commit_sync_with_offsets_timeout(
&mut self,
offsets: HashMap<TopicPartition, OffsetAndMetadata>,
_timeout: Duration,
) -> Result<(), Error>
async fn commit_sync_with_offsets_timeout( &mut self, offsets: HashMap<TopicPartition, OffsetAndMetadata>, _timeout: Duration, ) -> Result<(), Error>
Source§async fn commit_async(&mut self) -> Result<(), Error>
async fn commit_async(&mut self) -> Result<(), Error>
Self::poll for all the subscribed list of topics
and partition. Same as commitAsync(None) Read moreSource§async fn commit_async_with_callback(
&mut self,
callback: Arc<dyn OffsetCommitCallback>,
) -> Result<(), Error>
async fn commit_async_with_callback( &mut self, callback: Arc<dyn OffsetCommitCallback>, ) -> Result<(), Error>
Source§async fn commit_async_with_offsets_callback(
&mut self,
offsets: HashMap<TopicPartition, OffsetAndMetadata>,
callback: Arc<dyn OffsetCommitCallback>,
) -> Result<(), Error>
async fn commit_async_with_offsets_callback( &mut self, offsets: HashMap<TopicPartition, OffsetAndMetadata>, callback: Arc<dyn OffsetCommitCallback>, ) -> Result<(), Error>
Source§async fn seek_with_offset(
&mut self,
partition: TopicPartition,
offset: i64,
) -> Result<(), Error>
async fn seek_with_offset( &mut self, partition: TopicPartition, offset: i64, ) -> Result<(), Error>
Source§async fn seek_with_offset_and_metadata(
&mut self,
partition: TopicPartition,
offset_and_metadata: OffsetAndMetadata,
) -> Result<(), Error>
async fn seek_with_offset_and_metadata( &mut self, partition: TopicPartition, offset_and_metadata: OffsetAndMetadata, ) -> Result<(), Error>
poll(timeout). If this API is invoked for the same partition more than
once, the latest offset will be used on the next poll(). Note that you
may lose data if this API is arbitrarily used in the middle of
consumption, to reset the fetch offsets. This method allows for setting
the leaderEpoch along with the desired offset. Read moreSource§async fn seek_to_beginning(
&mut self,
partitions: &[TopicPartition],
) -> Result<(), Error>
async fn seek_to_beginning( &mut self, partitions: &[TopicPartition], ) -> Result<(), Error>
Self::poll or Self::position are called. If no partitions are
provided, seek to the first offset for all of the currently assigned
partitions. Read moreSource§async fn seek_to_end(
&mut self,
partitions: &[TopicPartition],
) -> Result<(), Error>
async fn seek_to_end( &mut self, partitions: &[TopicPartition], ) -> Result<(), Error>
Self::poll or Self::position are called. If no partitions are
provided, seek to the final offset for all of the currently assigned
partitions. Read moreSource§async fn position(&mut self, partition: &TopicPartition) -> Result<i64, Error>
async fn position(&mut self, partition: &TopicPartition) -> Result<i64, Error>
Source§async fn position_with_timeout(
&mut self,
partition: &TopicPartition,
_timeout: Duration,
) -> Result<i64, Error>
async fn position_with_timeout( &mut self, partition: &TopicPartition, _timeout: Duration, ) -> Result<i64, Error>
Source§async fn committed(
&mut self,
partitions: &[TopicPartition],
) -> Result<HashMap<TopicPartition, Option<OffsetAndMetadata>>, Error>
async fn committed( &mut self, partitions: &[TopicPartition], ) -> Result<HashMap<TopicPartition, Option<OffsetAndMetadata>>, Error>
Source§async fn committed_with_timeout(
&mut self,
partitions: &[TopicPartition],
_timeout: Duration,
) -> Result<HashMap<TopicPartition, Option<OffsetAndMetadata>>, Error>
async fn committed_with_timeout( &mut self, partitions: &[TopicPartition], _timeout: Duration, ) -> Result<HashMap<TopicPartition, Option<OffsetAndMetadata>>, Error>
Source§async fn partitions_for(
&mut self,
topic: &str,
) -> Result<Vec<PartitionInfo>, Error>
async fn partitions_for( &mut self, topic: &str, ) -> Result<Vec<PartitionInfo>, Error>
Source§async fn partitions_for_with_timeout(
&mut self,
topic: &str,
_timeout: Duration,
) -> Result<Vec<PartitionInfo>, Error>
async fn partitions_for_with_timeout( &mut self, topic: &str, _timeout: Duration, ) -> Result<Vec<PartitionInfo>, Error>
Source§async fn list_topics(
&mut self,
) -> Result<HashMap<String, Vec<PartitionInfo>>, Error>
async fn list_topics( &mut self, ) -> Result<HashMap<String, Vec<PartitionInfo>>, Error>
Source§async fn list_topics_with_timeout(
&mut self,
_timeout: Duration,
) -> Result<HashMap<String, Vec<PartitionInfo>>, Error>
async fn list_topics_with_timeout( &mut self, _timeout: Duration, ) -> Result<HashMap<String, Vec<PartitionInfo>>, Error>
Source§async fn offsets_for_times(
&mut self,
_timestamps_to_search: HashMap<TopicPartition, i64>,
) -> Result<HashMap<TopicPartition, Option<OffsetAndTimestamp>>, Error>
async fn offsets_for_times( &mut self, _timestamps_to_search: HashMap<TopicPartition, i64>, ) -> Result<HashMap<TopicPartition, Option<OffsetAndTimestamp>>, Error>
None will be returned for
that partition. Read moreSource§async fn offsets_for_times_with_timeout(
&mut self,
timestamps_to_search: HashMap<TopicPartition, i64>,
_timeout: Duration,
) -> Result<HashMap<TopicPartition, Option<OffsetAndTimestamp>>, Error>
async fn offsets_for_times_with_timeout( &mut self, timestamps_to_search: HashMap<TopicPartition, i64>, _timeout: Duration, ) -> Result<HashMap<TopicPartition, Option<OffsetAndTimestamp>>, Error>
None will be returned for
that partition. Read moreSource§async fn beginning_offsets(
&mut self,
partitions: &[TopicPartition],
) -> Result<HashMap<TopicPartition, i64>, Error>
async fn beginning_offsets( &mut self, partitions: &[TopicPartition], ) -> Result<HashMap<TopicPartition, i64>, Error>
Source§async fn beginning_offsets_with_timeout(
&mut self,
partitions: &[TopicPartition],
_timeout: Duration,
) -> Result<HashMap<TopicPartition, i64>, Error>
async fn beginning_offsets_with_timeout( &mut self, partitions: &[TopicPartition], _timeout: Duration, ) -> Result<HashMap<TopicPartition, i64>, Error>
Source§async fn end_offsets(
&mut self,
partitions: &[TopicPartition],
) -> Result<HashMap<TopicPartition, i64>, Error>
async fn end_offsets( &mut self, partitions: &[TopicPartition], ) -> Result<HashMap<TopicPartition, i64>, Error>
read_uncommitted
isolation level, the end offset is the high watermark (that is, the offset of the last
successfully replicated message plus one). For read_committed consumers, the end
offset is the last stable offset (LSO), which is the minimum of the high watermark and
the smallest offset of any open transaction. Finally, if the partition has never been
written to, the end offset is 0. Read moreSource§async fn end_offsets_with_timeout(
&mut self,
partitions: &[TopicPartition],
_timeout: Duration,
) -> Result<HashMap<TopicPartition, i64>, Error>
async fn end_offsets_with_timeout( &mut self, partitions: &[TopicPartition], _timeout: Duration, ) -> Result<HashMap<TopicPartition, i64>, Error>
read_uncommitted
isolation level, the end offset is the high watermark (that is, the offset of the last
successfully replicated message plus one). For read_committed consumers, the end
offset is the last stable offset (LSO), which is the minimum of the high watermark and
the smallest offset of any open transaction. Finally, if the partition has never been
written to, the end offset is 0. Read moreSource§async fn pause(&mut self, partitions: &[TopicPartition]) -> Result<(), Error>
async fn pause(&mut self, partitions: &[TopicPartition]) -> Result<(), Error>
Self::poll will not return any records from these partitions until
they have been resumed using Self::resume. Note that this method
does not affect partition subscription. In particular, it does not cause
a group rebalance when automatic assignment is used. Read moreSource§async fn resume(&mut self, partitions: &[TopicPartition]) -> Result<(), Error>
async fn resume(&mut self, partitions: &[TopicPartition]) -> Result<(), Error>
Self::pause. New calls to
Self::poll will return records from these partitions if there are any to be fetched.
If the partitions were not previously paused, this method is a no-op. Read moreSource§async fn enforce_rebalance(&mut self) -> Result<(), Error>
async fn enforce_rebalance(&mut self) -> Result<(), Error>
Self::poll call. Note that this API does not
itself initiate the rebalance, so you must still call Self::poll. If
a rebalance is already in progress this call will be a no-op. If you wish
to force an additional rebalance you must complete the current one by
calling poll before retrying this API. Read moreSource§async fn enforce_rebalance_with_reason(
&mut self,
_reason: &str,
) -> Result<(), Error>
async fn enforce_rebalance_with_reason( &mut self, _reason: &str, ) -> Result<(), Error>
Self::poll call. Note that this API does not
itself initiate the rebalance, so you must still call Self::poll. If
a rebalance is already in progress this call will be a no-op. If you wish
to force an additional rebalance you must complete the current one by
calling poll before retrying this API. Read moreSource§async fn close(&mut self) -> Result<(), Error>
async fn close(&mut self) -> Result<(), Error>
Self::close for
details. Note that Self::wakeup cannot be used to interrupt close. Read moreSource§async fn close_with_options(
&mut self,
_options: CloseOptions,
) -> Result<(), Error>
async fn close_with_options( &mut self, _options: CloseOptions, ) -> Result<(), Error>
CloseOptions allows to specify a timeout
and a leave group behavior. If no timeout is specified, the default
timeout of 30 seconds is used. If no leave group behavior is specified,
the default leave group behavior is used. Read moreSource§fn wakeup(&self)
fn wakeup(&self)
WakeupError. If no
thread is blocking in a method which can throw WakeupError, the next call to such a
method will raise it instead. Read moreSource§fn handle(&self) -> ConsumerHandle
fn handle(&self) -> ConsumerHandle
Clone + Send + Sync ConsumerHandle exposing
Consumer::wakeup and the reentrant-safe consumer operations,
callable from a task / thread other than the one that owns the
consumer. Read moreSource§impl<K, V> Debug for MockConsumer<K, V>
impl<K, V> Debug for MockConsumer<K, V>
Source§impl<K, V> Drop for MockConsumer<K, V>
Rust-only: releases the rebalance listener. A listener that captured
Consumer::handle holds the shared SubscriptionState through the
handle, and that state stores the listener, so without this the cycle would
outlive the mock; Java’s garbage collector frees the same graph. The
release waits for the drop rather than close(), because Java’s
rebalance and losePartitions still run the listener on a closed mock
(org.apache.kafka.clients.consumer.MockConsumer#rebalance and org.apache.kafka.clients.consumer.MockConsumer#losePartitions make no ensureNotClosed() check).
impl<K, V> Drop for MockConsumer<K, V>
Rust-only: releases the rebalance listener. A listener that captured
Consumer::handle holds the shared SubscriptionState through the
handle, and that state stores the listener, so without this the cycle would
outlive the mock; Java’s garbage collector frees the same graph. The
release waits for the drop rather than close(), because Java’s
rebalance and losePartitions still run the listener on a closed mock
(org.apache.kafka.clients.consumer.MockConsumer#rebalance and org.apache.kafka.clients.consumer.MockConsumer#losePartitions make no ensureNotClosed() check).
Auto Trait Implementations§
impl<K, V> Freeze for MockConsumer<K, V>
impl<K, V> !RefUnwindSafe for MockConsumer<K, V>
impl<K, V> Send for MockConsumer<K, V>
impl<K, V> !Sync for MockConsumer<K, V>
impl<K, V> Unpin for MockConsumer<K, V>
impl<K, V> UnsafeUnpin for MockConsumer<K, V>
impl<K, V> !UnwindSafe for MockConsumer<K, V>
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
Source§impl<K, V, C> DynConsumer<K, V> for C
impl<K, V, C> DynConsumer<K, V> for C
Source§fn assignment(&mut self) -> HashSet<TopicPartition>
fn assignment(&mut self) -> HashSet<TopicPartition>
Source§fn subscription(&mut self) -> HashSet<String>
fn subscription(&mut self) -> HashSet<String>
Source§fn paused(&mut self) -> HashSet<TopicPartition>
fn paused(&mut self) -> HashSet<TopicPartition>
Source§fn group_metadata(&mut self) -> Arc<dyn ConsumerGroupMetadata>
fn group_metadata(&mut self) -> Arc<dyn ConsumerGroupMetadata>
Source§fn current_lag<'a>(
&'a mut self,
topic_partition: &'a TopicPartition,
) -> Pin<Box<dyn Future<Output = Result<Option<i64>, Error>> + Send + 'a>>
fn current_lag<'a>( &'a mut self, topic_partition: &'a TopicPartition, ) -> Pin<Box<dyn Future<Output = Result<Option<i64>, Error>> + Send + 'a>>
Source§fn metrics(&self) -> MetricsView
fn metrics(&self) -> MetricsView
Source§fn subscribe_with_topics<'a>(
&'a mut self,
topics: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn subscribe_with_topics<'a>( &'a mut self, topics: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn subscribe_with_topics_listener<'a>(
&'a mut self,
topics: Vec<String>,
listener: Arc<dyn ConsumerRebalanceListener>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn subscribe_with_topics_listener<'a>( &'a mut self, topics: Vec<String>, listener: Arc<dyn ConsumerRebalanceListener>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn subscribe_with_pattern<'a>(
&'a mut self,
pattern: SubscriptionPattern,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn subscribe_with_pattern<'a>( &'a mut self, pattern: SubscriptionPattern, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn subscribe_with_pattern_listener<'a>(
&'a mut self,
pattern: SubscriptionPattern,
listener: Arc<dyn ConsumerRebalanceListener>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn subscribe_with_pattern_listener<'a>( &'a mut self, pattern: SubscriptionPattern, listener: Arc<dyn ConsumerRebalanceListener>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn assign<'a>(
&'a mut self,
partitions: Vec<TopicPartition>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn assign<'a>( &'a mut self, partitions: Vec<TopicPartition>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn unsubscribe<'a>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn unsubscribe<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn poll<'a>(
&'a mut self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<ConsumerRecords<K, V>, Error>> + Send + 'a>>
fn poll<'a>( &'a mut self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<ConsumerRecords<K, V>, Error>> + Send + 'a>>
Consumer::poll. Read moreSource§fn commit_sync<'a>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn commit_sync<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn commit_sync_with_timeout<'a>(
&'a mut self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn commit_sync_with_timeout<'a>( &'a mut self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn commit_sync_with_offsets<'a>(
&'a mut self,
offsets: HashMap<TopicPartition, OffsetAndMetadata>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn commit_sync_with_offsets<'a>( &'a mut self, offsets: HashMap<TopicPartition, OffsetAndMetadata>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn commit_sync_with_offsets_timeout<'a>(
&'a mut self,
offsets: HashMap<TopicPartition, OffsetAndMetadata>,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn commit_sync_with_offsets_timeout<'a>( &'a mut self, offsets: HashMap<TopicPartition, OffsetAndMetadata>, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn commit_async<'a>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn commit_async<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn commit_async_with_callback<'a>(
&'a mut self,
callback: Arc<dyn OffsetCommitCallback>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn commit_async_with_callback<'a>( &'a mut self, callback: Arc<dyn OffsetCommitCallback>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn commit_async_with_offsets_callback<'a>(
&'a mut self,
offsets: HashMap<TopicPartition, OffsetAndMetadata>,
callback: Arc<dyn OffsetCommitCallback>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn commit_async_with_offsets_callback<'a>( &'a mut self, offsets: HashMap<TopicPartition, OffsetAndMetadata>, callback: Arc<dyn OffsetCommitCallback>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn seek_with_offset<'a>(
&'a mut self,
partition: TopicPartition,
offset: i64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn seek_with_offset<'a>( &'a mut self, partition: TopicPartition, offset: i64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn seek_with_offset_and_metadata<'a>(
&'a mut self,
partition: TopicPartition,
offset_and_metadata: OffsetAndMetadata,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn seek_with_offset_and_metadata<'a>( &'a mut self, partition: TopicPartition, offset_and_metadata: OffsetAndMetadata, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn seek_to_beginning<'a>(
&'a mut self,
partitions: &'a [TopicPartition],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn seek_to_beginning<'a>( &'a mut self, partitions: &'a [TopicPartition], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn seek_to_end<'a>(
&'a mut self,
partitions: &'a [TopicPartition],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn seek_to_end<'a>( &'a mut self, partitions: &'a [TopicPartition], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn position<'a>(
&'a mut self,
partition: &'a TopicPartition,
) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'a>>
fn position<'a>( &'a mut self, partition: &'a TopicPartition, ) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'a>>
Source§fn position_with_timeout<'a>(
&'a mut self,
partition: &'a TopicPartition,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'a>>
fn position_with_timeout<'a>( &'a mut self, partition: &'a TopicPartition, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'a>>
Source§fn committed<'a>(
&'a mut self,
partitions: &'a [TopicPartition],
) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, Option<OffsetAndMetadata>>, Error>> + Send + 'a>>
fn committed<'a>( &'a mut self, partitions: &'a [TopicPartition], ) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, Option<OffsetAndMetadata>>, Error>> + Send + 'a>>
Source§fn committed_with_timeout<'a>(
&'a mut self,
partitions: &'a [TopicPartition],
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, Option<OffsetAndMetadata>>, Error>> + Send + 'a>>
fn committed_with_timeout<'a>( &'a mut self, partitions: &'a [TopicPartition], timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, Option<OffsetAndMetadata>>, Error>> + Send + 'a>>
Source§fn partitions_for<'a>(
&'a mut self,
topic: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Vec<PartitionInfo>, Error>> + Send + 'a>>
fn partitions_for<'a>( &'a mut self, topic: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Vec<PartitionInfo>, Error>> + Send + 'a>>
Source§fn partitions_for_with_timeout<'a>(
&'a mut self,
topic: &'a str,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<Vec<PartitionInfo>, Error>> + Send + 'a>>
fn partitions_for_with_timeout<'a>( &'a mut self, topic: &'a str, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<PartitionInfo>, Error>> + Send + 'a>>
Source§fn list_topics<'a>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<PartitionInfo>>, Error>> + Send + 'a>>
fn list_topics<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<PartitionInfo>>, Error>> + Send + 'a>>
Source§fn list_topics_with_timeout<'a>(
&'a mut self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<PartitionInfo>>, Error>> + Send + 'a>>
fn list_topics_with_timeout<'a>( &'a mut self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<PartitionInfo>>, Error>> + Send + 'a>>
Source§fn offsets_for_times<'a>(
&'a mut self,
timestamps_to_search: HashMap<TopicPartition, i64>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, Option<OffsetAndTimestamp>>, Error>> + Send + 'a>>
fn offsets_for_times<'a>( &'a mut self, timestamps_to_search: HashMap<TopicPartition, i64>, ) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, Option<OffsetAndTimestamp>>, Error>> + Send + 'a>>
Source§fn offsets_for_times_with_timeout<'a>(
&'a mut self,
timestamps_to_search: HashMap<TopicPartition, i64>,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, Option<OffsetAndTimestamp>>, Error>> + Send + 'a>>
fn offsets_for_times_with_timeout<'a>( &'a mut self, timestamps_to_search: HashMap<TopicPartition, i64>, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, Option<OffsetAndTimestamp>>, Error>> + Send + 'a>>
Source§fn beginning_offsets<'a>(
&'a mut self,
partitions: &'a [TopicPartition],
) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, i64>, Error>> + Send + 'a>>
fn beginning_offsets<'a>( &'a mut self, partitions: &'a [TopicPartition], ) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, i64>, Error>> + Send + 'a>>
Source§fn beginning_offsets_with_timeout<'a>(
&'a mut self,
partitions: &'a [TopicPartition],
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, i64>, Error>> + Send + 'a>>
fn beginning_offsets_with_timeout<'a>( &'a mut self, partitions: &'a [TopicPartition], timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, i64>, Error>> + Send + 'a>>
Source§fn end_offsets<'a>(
&'a mut self,
partitions: &'a [TopicPartition],
) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, i64>, Error>> + Send + 'a>>
fn end_offsets<'a>( &'a mut self, partitions: &'a [TopicPartition], ) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, i64>, Error>> + Send + 'a>>
Source§fn end_offsets_with_timeout<'a>(
&'a mut self,
partitions: &'a [TopicPartition],
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, i64>, Error>> + Send + 'a>>
fn end_offsets_with_timeout<'a>( &'a mut self, partitions: &'a [TopicPartition], timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<HashMap<TopicPartition, i64>, Error>> + Send + 'a>>
Source§fn pause<'a>(
&'a mut self,
partitions: &'a [TopicPartition],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn pause<'a>( &'a mut self, partitions: &'a [TopicPartition], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Consumer::pause. Read moreSource§fn resume<'a>(
&'a mut self,
partitions: &'a [TopicPartition],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn resume<'a>( &'a mut self, partitions: &'a [TopicPartition], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn enforce_rebalance<'a>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn enforce_rebalance<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn enforce_rebalance_with_reason<'a>(
&'a mut self,
reason: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn enforce_rebalance_with_reason<'a>( &'a mut self, reason: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn close<'a>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn close<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Consumer::close. Read moreSource§fn close_with_options<'a>(
&'a mut self,
options: CloseOptions,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn close_with_options<'a>( &'a mut self, options: CloseOptions, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Source§fn wakeup(&self)
fn wakeup(&self)
Consumer::wakeup.