Forum Discussion
btsui
Dec 30, 2024Copper Contributor
Behavior when Batch Send Failed
Hi All,
I am looking to send messages in batches to both Log Analytics and Event Hub services. My solution requires that the sent batches be all-or-none, meaning either all messages are sent successfully, or all messages are dropped in case of failure.
Could you please clarify how Log Analytics and Event Hub handle failures during batch sends?
Try below:
Log Analytics
Log Analytics doesn't inherently support batch sends directly. If you're using a connector or API to send data in batches, you'll need to implement your own logic to ensure all-or-none behavior. This typically involves:
- Retries: Implement retry logic to attempt sending the batch again if it fails.
- Transaction Management: Use a transaction mechanism to ensure that either all messages are committed or none are.
Event Hub
Event Hub supports batch sends, and it handles failures by allowing you to define a retry policy. Here’s how it works:
- Retry Policy: You can configure a retry policy to automatically retry sending the batch in case of transient failures.
- EventHubBufferedProducerClient: This client provides an event handler for batch send failures, allowing you to implement custom logic to handle failures.
- Concurrency Settings: Ensure that MaximumConcurrentSends and MaximumConcurrentSendsPerPartition are set appropriately to manage concurrent sends and retries.
Try below:
Log Analytics
Log Analytics doesn't inherently support batch sends directly. If you're using a connector or API to send data in batches, you'll need to implement your own logic to ensure all-or-none behavior. This typically involves:
- Retries: Implement retry logic to attempt sending the batch again if it fails.
- Transaction Management: Use a transaction mechanism to ensure that either all messages are committed or none are.
Event Hub
Event Hub supports batch sends, and it handles failures by allowing you to define a retry policy. Here’s how it works:
- Retry Policy: You can configure a retry policy to automatically retry sending the batch in case of transient failures.
- EventHubBufferedProducerClient: This client provides an event handler for batch send failures, allowing you to implement custom logic to handle failures.
- Concurrency Settings: Ensure that MaximumConcurrentSends and MaximumConcurrentSendsPerPartition are set appropriately to manage concurrent sends and retries.