Setting the file. One moment.
Chapter 15 · Azure Diagnostics
Subchapter 15.37
troubleshooting/messaging/azure-eventhubs-dotnet.mdMarkdown3 KBView on GitHub
Package: Azure.Messaging.EventHubs | README |
| Exception | Reason | Fix |
|---|---|---|
EventHubsException (ServiceTimeout) | Service didn’t respond in time | Transient — retried automatically. Verify state if persists |
EventHubsException (QuotaExceeded) | Too many active readers per consumer group | Reduce concurrent receivers or upgrade tier |
EventHubsException (ConsumerDisconnected) | Higher priority consumer took ownership | Expected during load balancing; check if scaling |
EventHubsException (MessageSizeExceeded) | Event too large | Reduce event payload; unlikely in practice since the client caps at the service link limit |
UnauthorizedAccessException | Bad credentials | Verify connection string, SAS token, or RBAC roles |
try { /* receive events */ }
catch (EventHubsException ex) when (ex.Reason == EventHubsException.FailureReason.ConsumerDisconnected)
{
// Handle consumer disconnection
}Configure via EventHubsRetryOptions when creating the client. See Configuring retry thresholds sample (opens in a new tab).
EventHubConnection across clients if needed. Always call CloseAsync or DisposeAsync.Azure.Messaging.EventHubs to Warning.EventHubsTransportType.AmqpWebSockets to connect over port 443 when AMQP ports (5761, 5762) are blocked.Package: Azure.Messaging.EventHubs.Processor (includes EventProcessorClient + blob checkpoint store)
Auth:
DefaultAzureCredentialis for local development. See auth-best-practices.md for production patterns.
var credential = new DefaultAzureCredential();
var storageClient = new BlobContainerClient(
new Uri("https://<storage-account>.blob.core.windows.net/<checkpoint-container>"),
credential);
var processor = new EventProcessorClient(
storageClient,
"$Default",
"<your-namespace>.servicebus.windows.net",
"<your-eventhub>",
credential);
processor.ProcessEventAsync += async (args) =>
{
// process event
await args.UpdateCheckpointAsync();
};Common issues:
UpdateCheckpointAsync() per batch, not per event, to reduce storage calls.