pub struct ConsumerBuilder<Exe: Executor> { /* private fields */ }Expand description
Implementations§
Source§impl<Exe: Executor> ConsumerBuilder<Exe>
impl<Exe: Executor> ConsumerBuilder<Exe>
Sourcepub fn new(pulsar: &Pulsar<Exe>) -> Self
pub fn new(pulsar: &Pulsar<Exe>) -> Self
Creates a new ConsumerBuilder from an existing client instance
Sourcepub fn with_topic<S: Into<String>>(self, topic: S) -> ConsumerBuilder<Exe>
pub fn with_topic<S: Into<String>>(self, topic: S) -> ConsumerBuilder<Exe>
sets the consumer’s topic or add one to the list of topics
Sourcepub fn with_topics<S: AsRef<str>, I: IntoIterator<Item = S>>(
self,
topics: I,
) -> ConsumerBuilder<Exe>
pub fn with_topics<S: AsRef<str>, I: IntoIterator<Item = S>>( self, topics: I, ) -> ConsumerBuilder<Exe>
adds a list of topics to the future consumer
Sourcepub fn with_topic_regex(self, regex: Regex) -> ConsumerBuilder<Exe>
pub fn with_topic_regex(self, regex: Regex) -> ConsumerBuilder<Exe>
sets up a consumer that will listen on all topics matching the regular expression
Sourcepub fn with_subscription<S: Into<String>>(self, subscription: S) -> Self
pub fn with_subscription<S: Into<String>>(self, subscription: S) -> Self
sets the subscription’s name
Sourcepub fn with_subscription_type(self, subscription_type: SubType) -> Self
pub fn with_subscription_type(self, subscription_type: SubType) -> Self
sets the kind of subscription
Sourcepub fn with_lookup_namespace<S: Into<String>>(self, namespace: S) -> Self
pub fn with_lookup_namespace<S: Into<String>>(self, namespace: S) -> Self
Tenant/Namespace to be used when matching against a regex. For other consumers,
specify namespace using the <persistent|non-persistent://<tenant>/<namespace>/<topic>
topic format.
Defaults to public/default if not specifid
Sourcepub fn with_topic_refresh(self, refresh_interval: Duration) -> Self
pub fn with_topic_refresh(self, refresh_interval: Duration) -> Self
Interval for refreshing the topics when using a topic regex. Unused otherwise.
Sourcepub fn with_consumer_id(self, consumer_id: u64) -> Self
pub fn with_consumer_id(self, consumer_id: u64) -> Self
sets the consumer id for this consumer
Sourcepub fn with_consumer_name<S: Into<String>>(self, consumer_name: S) -> Self
pub fn with_consumer_name<S: Into<String>>(self, consumer_name: S) -> Self
sets the consumer’s name
Sourcepub fn with_batch_size(self, batch_size: u32) -> Self
pub fn with_batch_size(self, batch_size: u32) -> Self
sets the batch size
batch messages containing more than the configured batch size will not be sent by Pulsar
default value: 1000
Sourcepub fn with_options(self, options: ConsumerOptions) -> Self
pub fn with_options(self, options: ConsumerOptions) -> Self
sets consumer options
Sourcepub fn with_dead_letter_policy(
self,
dead_letter_policy: DeadLetterPolicy,
) -> Self
pub fn with_dead_letter_policy( self, dead_letter_policy: DeadLetterPolicy, ) -> Self
sets the dead letter policy
Sourcepub fn with_unacked_message_resend_delay(self, delay: Option<Duration>) -> Self
pub fn with_unacked_message_resend_delay(self, delay: Option<Duration>) -> Self
The time after which a message is dropped without being acknowledged or nacked
that the message is resent. If None, messages will only be resent when a
consumer disconnects with pending unacknowledged messages.
Sourcepub async fn build<T: DeserializeMessage>(
self,
) -> Result<Consumer<T, Exe>, Error>
pub async fn build<T: DeserializeMessage>( self, ) -> Result<Consumer<T, Exe>, Error>
creates a Consumer from this builder
Sourcepub async fn into_reader<T: DeserializeMessage>(
self,
) -> Result<Reader<T, Exe>, Error>
pub async fn into_reader<T: DeserializeMessage>( self, ) -> Result<Reader<T, Exe>, Error>
creates a Reader from this builder
Trait Implementations§
Source§impl<Exe: Clone + Executor> Clone for ConsumerBuilder<Exe>
impl<Exe: Clone + Executor> Clone for ConsumerBuilder<Exe>
Source§fn clone(&self) -> ConsumerBuilder<Exe>
fn clone(&self) -> ConsumerBuilder<Exe>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<Exe> Freeze for ConsumerBuilder<Exe>
impl<Exe> !RefUnwindSafe for ConsumerBuilder<Exe>
impl<Exe> Send for ConsumerBuilder<Exe>
impl<Exe> Sync for ConsumerBuilder<Exe>
impl<Exe> Unpin for ConsumerBuilder<Exe>
impl<Exe> !UnwindSafe for ConsumerBuilder<Exe>
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more