pub struct KafkaTopic { /* private fields */ }Expand description
A subscription to one Kafka topic through one consumer group.
Everything except the topic name is optional; unset options fall back to the librdkafka
defaults (this crate does not impose its own). The group can also come from
KafkaBroker::default_group; a subscription that ends up with no group at all is a
startup error, because Kafka cannot subscribe without one.
§Examples
use ruststream_rdkafka::{Commit, KafkaTopic, StartOffset};
let topic = KafkaTopic::new("orders")
.group("orders-svc")
.start(StartOffset::Earliest)
.commit(Commit::Tracked)
.config("fetch.min.bytes", "1024");
assert_eq!(topic.topic(), "orders");Implementations§
Source§impl KafkaTopic
impl KafkaTopic
Sourcepub fn new(topic: impl Into<String>) -> Self
pub fn new(topic: impl Into<String>) -> Self
Describes a subscription to topic with librdkafka defaults for everything else.
Sourcepub fn group(self, group: impl Into<String>) -> Self
pub fn group(self, group: impl Into<String>) -> Self
The consumer group for this subscription, overriding
KafkaBroker::default_group.
Sourcepub fn start(self, start: StartOffset) -> Self
pub fn start(self, start: StartOffset) -> Self
Where the group starts when it has no committed offset (see StartOffset).
Sourcepub fn commit(self, commit: Commit) -> Self
pub fn commit(self, commit: Commit) -> Self
How processed deliveries are committed (see Commit).
Trait Implementations§
Source§impl Clone for KafkaTopic
impl Clone for KafkaTopic
Source§fn clone(&self) -> KafkaTopic
fn clone(&self) -> KafkaTopic
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KafkaTopic
impl Debug for KafkaTopic
Source§impl SubscriptionSource<KafkaBroker> for KafkaTopic
impl SubscriptionSource<KafkaBroker> for KafkaTopic
Source§type Subscriber = KafkaSubscriber
type Subscriber = KafkaSubscriber
The subscriber type this source opens.
Source§async fn subscribe(
self,
broker: &KafkaBroker,
) -> Result<Self::Subscriber, KafkaError>
async fn subscribe( self, broker: &KafkaBroker, ) -> Result<Self::Subscriber, KafkaError>
Source§impl SubscriptionSource<KafkaTestBroker> for KafkaTopic
Available on crate feature testing only.
impl SubscriptionSource<KafkaTestBroker> for KafkaTopic
Available on crate feature
testing only.Source§type Subscriber = KafkaTestSubscriber
type Subscriber = KafkaTestSubscriber
The subscriber type this source opens.
Source§async fn subscribe(
self,
broker: &KafkaTestBroker,
) -> Result<Self::Subscriber, KafkaError>
async fn subscribe( self, broker: &KafkaTestBroker, ) -> Result<Self::Subscriber, KafkaError>
Auto Trait Implementations§
impl Freeze for KafkaTopic
impl RefUnwindSafe for KafkaTopic
impl Send for KafkaTopic
impl Sync for KafkaTopic
impl Unpin for KafkaTopic
impl UnsafeUnpin for KafkaTopic
impl UnwindSafe for KafkaTopic
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