Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement clean shutdown of Event Hubs senders #257

Merged
merged 2 commits into from
Jun 16, 2023

Conversation

sebastianburckhardt
Copy link
Member

To avoid exceptions during host shutdowns, this PR adds code that cleanly terminates the event hubs senders before stopping the event hub clients.

It works as follows:

  • a cancellation token is passed to the batchworker that performs the sending.
  • this token is triggered as the first thing when a host is shutting down.
  • from that point on, the batchworker will no longer process new events.
  • at some point during shutdown, we call WaitForShutdownAsync().
  • only after that do we destruct the event hub client that constructed the sender.

This guarantees that the sender is no longer active by the time we close the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant