4

I'm trying to send a batched events using Microsoft.Azure.EventHubs call "SendAsync(IEnumerable)".

Is this a transactional operation i.e. is there possiblity of partial success/failure? Is there any official documentation confirming that there will be no duplicates if I resend in case this API throws an exception?

1 Answers1

1
  • All sendAsync calls either all succeed or fail together--partial success is not possible.
  • If the sendAsync call doesn't throw an exception, then the service will take responsibility of delivering the events. If it throw, then the events are not sent. If the request times out before getting a response from the service, then it's unclear whether the sent was successful or not.
  • Everytime you send event(s), neither the EventHubProducerClient nor the Event Hubs service has any notion of identifying an event -- it's a new piece of data

(Your docs are for v4 of the library, which doesn't have the EventHubProducerClient. This is from version 5.2.0 in case you're wondering.)

If you're worrying about duplication of events, then you'll need to determine what the needs of your application are -- is it better to lose data or to deal with it when processing? (You can add custom metadata to events to help you decide how to process them--sample.) Event Hubs has an at-least-once guarantee, so even if you don't publish duplicates, there is a chance the service will return some events multiple times. This is common for a messaging service.

If you have more questions about this, I'd recommend filing an issue in this GitHub repo where the new library lives.

lily_m
  • 371
  • 4
  • 5