pub struct PulsarSubscription { /* private fields */ }Expand description
A subscription descriptor for one Pulsar subscription over one or more topics.
Where the subscription starts reading is not a descriptor option: it is the framework’s
start_at(..) clause over PulsarPosition, which the Seekable
capability backs.
Implements SubscriptionSource, so it can sit inline in the #[subscriber(..)]
decorator:
use std::time::Duration;
use ruststream_pulsar::{DeadLetter, PulsarSubscription, SubscriptionType};
let source = PulsarSubscription::new("orders", "workers")
.subscription_type(SubscriptionType::Shared)
.dead_letter(DeadLetter::new("orders-dlq").max_deliveries(5))
.ack_timeout(Duration::from_secs(30));Implementations§
Source§impl PulsarSubscription
impl PulsarSubscription
Sourcepub fn new(topic: impl Into<String>, subscription: impl Into<String>) -> Self
pub fn new(topic: impl Into<String>, subscription: impl Into<String>) -> Self
Subscribes subscription to topic (a bare name, a tenant/namespace/topic triple,
or a fully qualified name).
Sourcepub fn topics<I, S>(topics: I, subscription: impl Into<String>) -> Self
pub fn topics<I, S>(topics: I, subscription: impl Into<String>) -> Self
Subscribes to every topic in the list.
Sourcepub fn pattern(
pattern: impl Into<String>,
subscription: impl Into<String>,
) -> Self
pub fn pattern( pattern: impl Into<String>, subscription: impl Into<String>, ) -> Self
Subscribes to every topic in the lookup namespace whose name matches pattern (a
regular expression, validated on subscribe).
Sourcepub fn subscription_type(self, sub_type: SubscriptionType) -> Self
pub fn subscription_type(self, sub_type: SubscriptionType) -> Self
Sets the subscription type. Defaults to SubscriptionType::Shared.
Sourcepub fn dead_letter(self, dead_letter: DeadLetter) -> Self
pub fn dead_letter(self, dead_letter: DeadLetter) -> Self
Sets the consumer-side dead-letter policy.
Sourcepub fn ack_timeout(self, timeout: Duration) -> Self
pub fn ack_timeout(self, timeout: Duration) -> Self
Redelivers messages that stay unacknowledged longer than timeout.
Sourcepub fn subscription(&self) -> &str
pub fn subscription(&self) -> &str
The subscription name.
Trait Implementations§
Source§impl Clone for PulsarSubscription
impl Clone for PulsarSubscription
Source§fn clone(&self) -> PulsarSubscription
fn clone(&self) -> PulsarSubscription
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more