pub struct EventHubProducerClient<RP> { /* private fields */ }Expand description
A client responsible for publishing EventData to a specific Event Hub, grouped together in
batches. Depending on the options specified when sending, events may be automatically assigned
an available partition or may request a specific partition.
The EventHubProducerClient publishes immediately, ensuring a deterministic outcome for each
send operation, though requires that callers own the responsibility of building and managing
batches.
Implementations§
Source§impl EventHubProducerClient<BasicRetryPolicy>
impl EventHubProducerClient<BasicRetryPolicy>
Sourcepub fn with_policy<P>() -> EventHubProducerClientBuilder<P>where
P: EventHubsRetryPolicy + Send,
pub fn with_policy<P>() -> EventHubProducerClientBuilder<P>where
P: EventHubsRetryPolicy + Send,
Creates a new client with a custom retry policy.
Sourcepub async fn new_from_connection_string(
connection_string: impl Into<String>,
event_hub_name: impl Into<Option<String>>,
client_options: EventHubProducerClientOptions,
) -> Result<Self, Error>
pub async fn new_from_connection_string( connection_string: impl Into<String>, event_hub_name: impl Into<Option<String>>, client_options: EventHubProducerClientOptions, ) -> Result<Self, Error>
Creates a EventHubProducerClient using a connection string.
Sourcepub async fn new_from_credential(
fully_qualified_namespace: impl Into<String>,
event_hub_name: impl Into<String>,
credential: impl Into<EventHubTokenCredential>,
client_options: EventHubProducerClientOptions,
) -> Result<Self, Error>
pub async fn new_from_credential( fully_qualified_namespace: impl Into<String>, event_hub_name: impl Into<String>, credential: impl Into<EventHubTokenCredential>, client_options: EventHubProducerClientOptions, ) -> Result<Self, Error>
Creates a EventHubProducerClient using a namespace and a credential.
Sourcepub async fn new_from_named_key_credential(
fully_qualified_namespace: impl Into<String>,
event_hub_name: impl Into<String>,
credential: AzureNamedKeyCredential,
client_options: EventHubProducerClientOptions,
) -> Result<Self, Error>
pub async fn new_from_named_key_credential( fully_qualified_namespace: impl Into<String>, event_hub_name: impl Into<String>, credential: AzureNamedKeyCredential, client_options: EventHubProducerClientOptions, ) -> Result<Self, Error>
Creates a EventHubProducerClient using a namespace and a AzureNamedKeyCredential.
Sourcepub async fn new_from_sas_credential(
fully_qualified_namespace: impl Into<String>,
event_hub_name: impl Into<String>,
credential: AzureSasCredential,
client_options: EventHubProducerClientOptions,
) -> Result<Self, Error>
pub async fn new_from_sas_credential( fully_qualified_namespace: impl Into<String>, event_hub_name: impl Into<String>, credential: AzureSasCredential, client_options: EventHubProducerClientOptions, ) -> Result<Self, Error>
Creates a EventHubProducerClient using a namespace and a AzureSasCredential.
Sourcepub fn with_connection(
connection: &mut EventHubConnection,
client_options: EventHubProducerClientOptions,
) -> Self
pub fn with_connection( connection: &mut EventHubConnection, client_options: EventHubProducerClientOptions, ) -> Self
Creates a EventHubProducerClient using a EventHubConnection.
Source§impl<RP> EventHubProducerClient<RP>
impl<RP> EventHubProducerClient<RP>
Sourcepub async fn create_batch(
&mut self,
options: CreateBatchOptions,
) -> Result<EventDataBatch, Error>
pub async fn create_batch( &mut self, options: CreateBatchOptions, ) -> Result<EventDataBatch, Error>
Creates a new EventDataBatch with the given options.
Sourcepub async fn send_event(
&mut self,
event: impl Into<EventData>,
options: SendEventOptions,
) -> Result<(), Error>
pub async fn send_event( &mut self, event: impl Into<EventData>, options: SendEventOptions, ) -> Result<(), Error>
Sends a single event to the Event Hub.
Sourcepub async fn send_events<E>(
&mut self,
events: E,
options: SendEventOptions,
) -> Result<(), Error>
pub async fn send_events<E>( &mut self, events: E, options: SendEventOptions, ) -> Result<(), Error>
Sends a set of events to the Event Hub.
Sourcepub async fn send_batch(
&mut self,
batch: EventDataBatch,
options: SendEventOptions,
) -> Result<(), Error>
pub async fn send_batch( &mut self, batch: EventDataBatch, options: SendEventOptions, ) -> Result<(), Error>
Sends a batch of events to the Event Hub.
Sourcepub async fn get_event_hub_properties(
&mut self,
) -> Result<EventHubProperties, Error>
pub async fn get_event_hub_properties( &mut self, ) -> Result<EventHubProperties, Error>
Retrieves information about the Event Hub that the connection is associated with, including the number of partitions present and their identifiers.
Sourcepub async fn get_partition_ids(&mut self) -> Result<Vec<String>, Error>
pub async fn get_partition_ids(&mut self) -> Result<Vec<String>, Error>
Retrieves the set of identifiers for the partitions of an Event Hub.
Sourcepub async fn get_partition_properties(
&mut self,
partition_id: &str,
) -> Result<PartitionProperties, Error>
pub async fn get_partition_properties( &mut self, partition_id: &str, ) -> Result<PartitionProperties, Error>
Retrieves information about a specific partition for an Event Hub, including elements that describe the available events in the partition event stream.