Struct pulsar::consumer::builder::ConsumerBuilder
source · 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§
Auto 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> 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