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 schema(&self) -> SchemaRegistryClient
pub fn schema(&self) -> SchemaRegistryClient
Returns a SchemaRegistryClient for schema registry operations.
The returned client shares the same connection manager and auth service as the DanubeClient
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 resolve_topic_broker(&self, topic: &str) -> Result<BrokerAddress>
pub async fn resolve_topic_broker(&self, topic: &str) -> Result<BrokerAddress>
Resolve which broker owns a topic in the cluster.
Performs a topic lookup via the Discovery service and follows redirects to find the owning broker. Returns the broker address that the caller should connect to for this topic.
This is the recommended way for edge brokers and external services
to discover topic-to-broker assignment without needing direct access
to internal LookupService or ConnectionManager.
Sourcepub async fn get_broker_channel(
&self,
broker: &BrokerAddress,
) -> Result<Channel>
pub async fn get_broker_channel( &self, broker: &BrokerAddress, ) -> Result<Channel>
Get a gRPC channel to a specific broker.
Uses the client’s internal connection pool with TLS/mTLS already
configured (from DanubeClientBuilder). Connections are cached —
repeated calls for the same broker return the same channel.
The returned Channel can be used to construct any gRPC service
client (e.g., EdgeReplicatorServiceClient::new(channel)).
Trait Implementations§
Source§impl Clone for DanubeClient
impl Clone for DanubeClient
Source§fn clone(&self) -> DanubeClient
fn clone(&self) -> DanubeClient
1.0.0 (const: unstable) · 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 UnsafeUnpin 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