Struct pulsar::consumer::builder::ConsumerBuilder

source ·
pub struct ConsumerBuilder<Exe: Executor> { /* private fields */ }
Expand description

Builder structure for consumers

This is the main way to create a Consumer or a Reader

Implementations§

source§

impl<Exe: Executor> ConsumerBuilder<Exe>

source

pub fn new(pulsar: &Pulsar<Exe>) -> Self

Creates a new ConsumerBuilder from an existing client instance

source

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

source

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

source

pub fn with_topic_regex(self, regex: Regex) -> ConsumerBuilder<Exe>

sets up a consumer that will listen on all topics matching the regular expression

source

pub fn with_subscription<S: Into<String>>(self, subscription: S) -> Self

sets the subscription’s name

source

pub fn with_subscription_type(self, subscription_type: SubType) -> Self

sets the kind of subscription

source

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

source

pub fn with_topic_refresh(self, refresh_interval: Duration) -> Self

Interval for refreshing the topics when using a topic regex. Unused otherwise.

source

pub fn with_consumer_id(self, consumer_id: u64) -> Self

sets the consumer id for this consumer

source

pub fn with_consumer_name<S: Into<String>>(self, consumer_name: S) -> Self

sets the consumer’s name

source

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

source

pub fn with_options(self, options: ConsumerOptions) -> Self

sets consumer options

source

pub fn with_dead_letter_policy( self, dead_letter_policy: DeadLetterPolicy ) -> Self

sets the dead letter policy

source

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.

source

pub async fn build<T: DeserializeMessage>( self ) -> Result<Consumer<T, Exe>, Error>

creates a Consumer from this builder

source

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>

source§

fn clone(&self) -> ConsumerBuilder<Exe>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more