EventHubProducerClient

Struct EventHubProducerClient 

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

Source

pub fn with_policy<P>() -> EventHubProducerClientBuilder<P>

Creates a new client with a custom retry policy.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn with_connection( connection: &mut EventHubConnection, client_options: EventHubProducerClientOptions, ) -> Self

Source§

impl<RP> EventHubProducerClient<RP>

Source

pub async fn create_batch( &mut self, options: CreateBatchOptions, ) -> Result<EventDataBatch, Error>

Creates a new EventDataBatch with the given options.

Source

pub async fn send_event( &mut self, event: impl Into<EventData>, options: SendEventOptions, ) -> Result<(), Error>

Sends a single event to the Event Hub.

Source

pub async fn send_events<E>( &mut self, events: E, options: SendEventOptions, ) -> Result<(), Error>

Sends a set of events to the Event Hub.

Source

pub async fn send_batch( &mut self, batch: EventDataBatch, options: SendEventOptions, ) -> Result<(), Error>

Sends a batch of events to the Event Hub.

Source

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.

Source

pub async fn get_partition_ids(&mut self) -> Result<Vec<String>, Error>

Retrieves the set of identifiers for the partitions of an Event Hub.

Source

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.

Source

pub async fn close(self) -> Result<(), Error>

Performs the task needed to clean up resources used by the EventHubProducerClient, including ensuring that the client itself has been closed.

This won’t close the underlying connection if the connection was shared among multiple clients.

Trait Implementations§

Source§

impl<RP: Debug> Debug for EventHubProducerClient<RP>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<RP> !Freeze for EventHubProducerClient<RP>

§

impl<RP> !RefUnwindSafe for EventHubProducerClient<RP>

§

impl<RP> Send for EventHubProducerClient<RP>
where RP: Send,

§

impl<RP> Sync for EventHubProducerClient<RP>
where RP: Sync,

§

impl<RP> Unpin for EventHubProducerClient<RP>
where RP: Unpin,

§

impl<RP> !UnwindSafe for EventHubProducerClient<RP>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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
Source§

impl<T> SendBound for T
where T: Send,