i'm new to Azure Webjobs. I was trying to achieve the GraceFul Shutdown. while using the WebJobsShutdownWatcher Class.
Public static void Main()
{
try
{
var config = new JobHostConfiguration();
if (config.IsDevelopment)
{
config.UseDevelopmentSettings();
}
var watcher = new WebJobsShutdownWatcher();
Task.Run(() =>
{
bool isCancelled = false;
while (!isCancelled)
{
if (watcher.Token.IsCancellationRequested)
{
Console.WriteLine("WebJob cancellation Token Requested!");
isCancelled = true;
}
}
}, watcher.Token).Wait();
var host = new JobHost();
The following code ensures that the WebJob will be running continuously
host.RunAndBlock();
}
catch (Exception)
{
Console.WriteLine("Error");
}
}
To Achieve the GraceFul ShutDown, i have stop the Webjob and again Hosted on azure. After Hosting on Azure, the Queues are not getting Trigger. when i Debug the Code the Control is Stop at the WebJobsShutdownWatcher Class. What did i Done Wrong ?