ConsumerBuilder

Struct ConsumerBuilder 

Source
pub struct ConsumerBuilder { /* private fields */ }
Expand description

ConsumerBuilder is a builder for creating a new Consumer instance.

It allows setting various properties for the consumer such as topic, name, subscription, subscription type, and options.

Implementations§

Source§

impl ConsumerBuilder

Source

pub fn new(client: &DanubeClient) -> Self

Source

pub fn with_topic(self, topic: impl Into<String>) -> Self

Sets the topic name for the consumer.

This method specifies the topic that the consumer will subscribe to. It is a required field and must be set before the consumer can be created.

§Parameters
  • topic: The name of the topic for the consumer. This should be a non-empty string that corresponds to an existing topic.
Source

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

Sets the name of the consumer instance.

This method specifies the name to be assigned to the consumer. It is a required field and must be set before the consumer can be created.

§Parameters
  • consumer_name: The name for the consumer instance. This should be a non-empty string that uniquely identifies the consumer.
Source

pub fn with_subscription(self, subscription_name: impl Into<String>) -> Self

Sets the name of the subscription for the consumer.

This method specifies the subscription that the consumer will use. It is a required field and must be set before the consumer can be created.

§Parameters
  • subscription_name: The name of the subscription. This should be a non-empty string that identifies the subscription to which the consumer will be subscribed.
Source

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

Sets the type of subscription for the consumer. This field is optional.

This method specifies the type of subscription that the consumer will use. The subscription type determines how messages are distributed to consumers that share the same subscription.

§Parameters
  • sub_type: The type of subscription. This should be one of the following:
    • SubType::Exclusive: The consumer exclusively receives all messages for the subscription.
    • SubType::Shared: Messages are distributed among multiple consumers sharing the same subscription. Default if not specified.
    • SubType::FailOver: Only one consumer receives messages, and if it fails, another consumer takes over.
Source

pub fn build(self) -> Consumer

Creates a new Consumer instance using the settings configured in the ConsumerBuilder.

This method performs validation to ensure that all required fields are set before creating the Consumer. Once validation is successful, it constructs and returns a new Consumer instance configured with the specified settings.

§Returns
  • A Consumer instance if the builder configuration is valid and the consumer is created successfully.

Trait Implementations§

Source§

impl Clone for ConsumerBuilder

Source§

fn clone(&self) -> ConsumerBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ConsumerBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

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

Source§

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>,

Source§

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>,

Source§

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