Azure / azure-webjobs-sdk

Azure WebJobs SDK
MIT License
739 stars 358 forks source link

Expose WebJobsShutdownWatcher for all shutdown events from Kudu #582

Open rustd opened 9 years ago

rustd commented 9 years ago

Creating this issue to separate this discussion from https://github.com/Azure/azure-webjobs-sdk/pull/55#issuecomment-147908325 Can you guys please provide examples for how these cancellation options are supposed to work? Also, it would be nice in the WebJobsShutdownWatcher if you guys exposed events for when the shutdown was triggered, not just the cancellation token, so we can handle shutdown gracefully. For example, I need to flush my ApplicationInsights telemetry before the process shuts down. Thanks!

robertmclaws commented 8 years ago

Any update on this? Would love to see it in the next release. Thanks!

mathewc commented 8 years ago

Can you explain your scenario a bit more and how you're using the shutdown watcher? You're just looking for an easy to use pattern for getting notified when the CancellationToken is actually being cancelled?

robertmclaws commented 8 years ago

Yeah, I have a set of helpers for Application Insights that gather additional data for executing WebJobs, and I want to make sure the data is sent to Azure before the process terminates. Right now AFAIK if you kill the process, the collected data is not sent before the process dies, and you lose the data.