I don't get the mechanics behind the cancellation token and the web jobs.
I know I can use Microsoft.Azure.WebJobs.WebJobsShutdownWatcher().Token
to get the token and react on token.IsCancellationRequested
eg when the WebJobs are updated.
Scenario: Continuous job, triggered by a service bus message. The job calls a method in my data layer. This method does some updates on different tables on an azure sql database. This method runs for about two minutes.
Now I would pass the token to the data layer and there I would do my work while no cancellation is requested; else I would end my updates.
Now the questions:
Does the job host wait for my method until it is finished and then stops?
Do I have to set the "stopping_wait_time" to a value (what is the default anyway?) high enough to be sure my job finishes properly?
If a new message is written to the service bus queue, does this message trigger a new job despite the fact that a cancellation is pending?
Thanks for any clarifications!