共用方式為


Azure.Messaging.EventHubs.Producer Namespace

Classes

CreateBatchOptions

The set of options that can be specified to influence the way in which an event batch behaves and is sent to the Event Hubs service.

EnqueueEventOptions

The set of options that can be specified to influence the way in which events are published to the Event Hubs service.

EventDataBatch

A set of EventData with size constraints known up-front, intended to be sent to the Event Hubs service in a single operation. When published, the result is atomic; either all events that belong to the batch were successful or all have failed. Partial success is not possible.

EventHubBufferedProducerClient

A client responsible for publishing instances of EventData to a specific Event Hub. Depending on the options specified when events are enqueued, they may be automatically assigned to a partition, grouped according to the specified partition key, or assigned a specifically requested partition.

The EventHubBufferedProducerClient does not publish immediately, instead using a deferred model where events are collected into a buffer so that they may be efficiently batched and published when the batch is full or the MaximumWaitTime has elapsed with no new events enqueued.

This model is intended to shift the burden of batch management from callers, at the cost of non-deterministic timing, for when events will be published. There are additional trade-offs to consider, as well:

  • If the application crashes, events in the buffer will not have been published. To prevent data loss, callers are encouraged to track publishing progress using the SendEventBatchSucceededAsync and SendEventBatchFailedAsync handlers.
  • Events specifying a partition key may be assigned a different partition than those using the same key with other producers.
  • In the unlikely event that a partition becomes temporarily unavailable, the EventHubBufferedProducerClient may take longer to recover than other producers.

In scenarios where it is important to have events published immediately with a deterministic outcome, ensure that partition keys are assigned to a partition consistent with other publishers, or where maximizing availability is a requirement, using the EventHubProducerClient is recommended.

EventHubBufferedProducerClientOptions

The set of options that can be specified when creating an EventHubBufferedProducerClient to configure its behavior.

EventHubProducerClient

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.

In scenarios where it is not important to have events published immediately and where maximizing partition availability is not a requirement, it is recommended to consider using the EventHubBufferedProducerClient, which takes responsibility for building and managing batches to reduce the complexity of doing so in application code.

EventHubProducerClientOptions

The set of options that can be specified when creating an EventHubProducerClient to configure its behavior.

SendEventBatchFailedEventArgs

Contains information about a batch that was unable to be published, as well as the exception that occurred and the partition that the batch was being published to.

SendEventBatchSucceededEventArgs

Contains information about a batch that was published and the partition that it was published to.

SendEventOptions

The set of options that can be specified to influence the way in which events are published to the Event Hubs service.