pub struct Client<C: ClientContext + 'static = DefaultClientContext> { /* private fields */ }
Expand description
A low-level rdkafka client.
This type is the basis of the consumers and producers in the consumer
and producer
modules, respectively.
Typically you do not want to construct a Client
directly, but instead
construct a consumer or producer. A Client
can be used, however, when
only access to cluster metadata and watermarks is required.
Implementations§
source§impl<C: ClientContext + 'static> Client<C>
impl<C: ClientContext + 'static> Client<C>
sourcepub fn new(
config: &ClientConfig,
native_config: NativeClientConfig,
rd_kafka_type: RDKafkaType,
context: C,
) -> KafkaResult<Client<C>>
pub fn new( config: &ClientConfig, native_config: NativeClientConfig, rd_kafka_type: RDKafkaType, context: C, ) -> KafkaResult<Client<C>>
Creates a new Client
given a configuration, a client type and a context.
sourcepub fn native_client(&self) -> &NativeClient
pub fn native_client(&self) -> &NativeClient
Returns a reference to the native rdkafka-sys client.
sourcepub fn native_ptr(&self) -> *mut RDKafka
pub fn native_ptr(&self) -> *mut RDKafka
Returns a pointer to the native rdkafka-sys client.
sourcepub fn fetch_metadata<T: Into<Timeout>>(
&self,
topic: Option<&str>,
timeout: T,
) -> KafkaResult<Metadata>
pub fn fetch_metadata<T: Into<Timeout>>( &self, topic: Option<&str>, timeout: T, ) -> KafkaResult<Metadata>
Returns the metadata information for the specified topic, or for all topics in the cluster if no topic is specified.
sourcepub fn fetch_watermarks<T: Into<Timeout>>(
&self,
topic: &str,
partition: i32,
timeout: T,
) -> KafkaResult<(i64, i64)>
pub fn fetch_watermarks<T: Into<Timeout>>( &self, topic: &str, partition: i32, timeout: T, ) -> KafkaResult<(i64, i64)>
Returns high and low watermark for the specified topic and partition.
sourcepub fn fetch_cluster_id<T: Into<Timeout>>(&self, timeout: T) -> Option<String>
pub fn fetch_cluster_id<T: Into<Timeout>>(&self, timeout: T) -> Option<String>
Returns the cluster identifier option or None if the cluster identifier is null
sourcepub fn fetch_group_list<T: Into<Timeout>>(
&self,
group: Option<&str>,
timeout: T,
) -> KafkaResult<GroupList>
pub fn fetch_group_list<T: Into<Timeout>>( &self, group: Option<&str>, timeout: T, ) -> KafkaResult<GroupList>
Returns the group membership information for the given group. If no group is specified, all groups will be returned.
sourcepub fn fatal_error(&self) -> Option<(RDKafkaErrorCode, String)>
pub fn fatal_error(&self) -> Option<(RDKafkaErrorCode, String)>
Returns the first fatal error set on this client instance, or None
if
no fatal error has occurred.
This function is intended to be used with idempotent producers, where some errors must logically be considered fatal to retain consistency.