Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Diagnose Azure service issues, query logs, and troubleshoot failures using GitHub Copilot for Azure
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
troubleshooting/messaging/azure-eventhubs-java.md
1# Azure Event Hubs SDK — Java23Package: `azure-messaging-eventhubs` | [README](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/eventhubs/azure-messaging-eventhubs/) | [Full Troubleshooting Guide](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/eventhubs/azure-messaging-eventhubs/TROUBLESHOOTING.md)45> ⚠️ **Note:** The detailed Java troubleshooting guide has moved to [Microsoft Learn](https://learn.microsoft.com/azure/developer/java/sdk/troubleshooting-messaging-event-hubs-overview).67## Common Errors89| Exception | Cause | Fix |10|-----------|-------|-----|11| `AmqpException` (connection:forced) | Idle connection disconnected | Auto-recovers; no action needed |12| `AmqpException` (unauthorized-access) | Bad credentials or missing permissions | Verify connection string, SAS, or RBAC roles |13| `AmqpException` (resource-limit-exceeded) | Too many concurrent receivers | Reduce receiver count or upgrade tier |14| `OperationTimeoutException` | Network issue or throttling | Check firewall, try AMQP over WebSockets (port 443) |1516## Enable Logging1718Configure via SLF4J. Add `logback-classic` dependency and set level for `com.azure.messaging.eventhubs`:1920```xml21<logger name="com.azure.messaging.eventhubs" level="DEBUG"/>22```2324For AMQP frame tracing:25```xml26<logger name="com.azure.core.amqp" level="DEBUG"/>27```2829See [Java SDK logging docs](https://learn.microsoft.com/azure/developer/java/sdk/troubleshooting-messaging-event-hubs-overview) for details.3031## Key Issues3233- **High CPU / partition imbalance**: Limit to 1.5–3 partitions per CPU core.34- **Consumer disconnected**: Higher priority consumer took ownership. Expected during load balancing. Persistent issues without scaling indicate a problem.35- **Connection sharing**: Reuse `EventHubClientBuilder` connections; avoid creating new clients per operation.3637## Checkpointing (BlobCheckpointStore)3839Package: `azure-messaging-eventhubs-checkpointstore-blob`4041> **Auth:** `DefaultAzureCredential` is for local development. See [auth-best-practices.md](auth-best-practices.md) for production patterns.4243```java44TokenCredential credential = new DefaultAzureCredentialBuilder().build();4546BlobContainerAsyncClient blobClient = new BlobContainerClientBuilder()47.endpoint("https://<storage-account>.blob.core.windows.net/<checkpoint-container>")48.credential(credential)49.buildAsyncClient();5051EventProcessorClient processor = new EventProcessorClientBuilder()52.credential("<your-namespace>.servicebus.windows.net", "<your-eventhub>", credential)53.consumerGroup("$Default")54.checkpointStore(new BlobCheckpointStore(blobClient))55.processEvent(eventContext -> {56// process event57eventContext.updateCheckpoint();58})59.buildEventProcessorClient();60```6162**Common issues:**63- **Soft delete / blob versioning**: Disable both on the storage account — they cause delays during load balancing.64- **HTTP 412/409 from storage**: Normal during partition ownership negotiation; not an error.65- **Checkpoint frequency**: Call `updateCheckpoint()` per batch, not per event, to reduce storage calls.6667## Filing Issues6869Include: partition count, machine specs, instance count, max heap (`-Xmx`), average `EventData` size, traffic pattern, and DEBUG-level logs (±10 min from issue).70