pub struct DanubeClient { /* private fields */ }Expand description
The main client for interacting with the Danube messaging system.
The DanubeClient struct is designed to facilitate communication with the Danube messaging system.
It provides various methods for managing producers and consumers, performing topic lookups, and retrieving schema information. This client acts as the central interface for interacting with the messaging system and managing connections and services.
Implementations§
Source§impl DanubeClient
impl DanubeClient
Sourcepub fn builder() -> DanubeClientBuilder
pub fn builder() -> DanubeClientBuilder
Initializes a new DanubeClientBuilder instance.
The builder pattern allows for configuring and constructing a DanubeClient instance with optional settings and options.
Using the builder, you can customize various aspects of the DanubeClient, such as connection settings, timeouts, and other configurations before creating the final DanubeClient instance.
Sourcepub fn new_producer(&self) -> ProducerBuilder
pub fn new_producer(&self) -> ProducerBuilder
Returns a new ProducerBuilder for configuring and creating a Producer instance.
This method initializes a ProducerBuilder, which is used to set up various options and settings for a Producer.
The builder pattern allows you to specify details such as the topic, producer name, partitions, schema, and other configurations before creating the final Producer instance.
Sourcepub fn new_consumer(&self) -> ConsumerBuilder
pub fn new_consumer(&self) -> ConsumerBuilder
Returns a new ConsumerBuilder for configuring and creating a Consumer instance.
This method initializes a ConsumerBuilder, which is used to set up various options and settings for a Consumer.
The builder pattern allows you to specify details such as the topic, consumer name, subscription, subscription type, and other configurations before creating the final Consumer instance.
Sourcepub fn auth_service(&self) -> &AuthService
pub fn auth_service(&self) -> &AuthService
Returns a reference to the AuthService.
This method provides access to the AuthService instance used by the DanubeClient.
Sourcepub async fn lookup_topic(
&self,
addr: &Uri,
topic: impl Into<String>,
) -> Result<LookupResult>
pub async fn lookup_topic( &self, addr: &Uri, topic: impl Into<String>, ) -> Result<LookupResult>
Retrieves the address of the broker responsible for a specified topic.
This asynchronous method performs a lookup to find the broker that is responsible for the given topic. The addr parameter specifies the address of the broker to connect to for performing the lookup. The method returns information about the broker handling the topic.
§Parameters
addr: The address of the broker to connect to for the lookup. This is provided as a&Uri, which specifies where the request should be sent.topic: The name of the topic for which to look up the broker.
§Returns
Ok(LookupResult): Contains the result of the lookup operation, including the broker address.Err(e): An error if the lookup fails or if there are issues during the operation. This could include connectivity problems, invalid topic names, or other errors related to the lookup process.
Sourcepub async fn get_schema(&self, topic: impl Into<String>) -> Result<Schema>
pub async fn get_schema(&self, topic: impl Into<String>) -> Result<Schema>
Retrieves the schema associated with a specified topic from the schema service.
This asynchronous method fetches the schema for the given topic from the schema service. The schema describes the structure and format of the messages for the specified topic. The method returns the schema details or an error if the retrieval fails.
§Parameters
topic: The name of the topic for which the schema is to be retrieved.
§Returns
Ok(Schema): The schema associated with the specified topic. This includes information about the schema type and its definition, if available.Err(e): An error if the schema retrieval fails or if there are issues during the operation. This could include errors such as non-existent topics, connectivity issues, or internal service errors.
Trait Implementations§
Source§impl Clone for DanubeClient
impl Clone for DanubeClient
Source§fn clone(&self) -> DanubeClient
fn clone(&self) -> DanubeClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for DanubeClient
impl !RefUnwindSafe for DanubeClient
impl Send for DanubeClient
impl Sync for DanubeClient
impl Unpin for DanubeClient
impl !UnwindSafe for DanubeClient
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request