Struct rdkafka::consumer::stream_consumer::StreamPartitionQueue
source · [−]pub struct StreamPartitionQueue<C, R = DefaultRuntime> where
C: ConsumerContext, { /* private fields */ }
Expand description
A message queue for a single partition of a StreamConsumer
.
See the documentation of StreamConsumer::split_partition_queue
for
details.
Implementations
Constructs a stream that yields messages from this partition.
It is legal to have multiple live message streams for the same partition, and to move those message streams across threads. Note, however, that the message streams share the same underlying state. A message received by the partition will be delivered to only one of the live message streams. If you seek the underlying partition, all message streams created from the partition will begin to draw messages from the new position of the partition.
If you want multiple independent views of a Kafka partition, create multiple consumers, not multiple partition streams.
Receives the next message from the stream.
This method will block until the next message is available or an error
occurs. It is legal to call recv
from multiple threads simultaneously.
Note that this method is exactly as efficient as constructing a single-use message stream and extracting one message from it:
use futures::stream::StreamExt;
partition_queue.stream().next().await.expect("MessageStream never returns None");