Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

tarwn/AzureWorkerRole_Cancellation

Repository files navigation

AzureWorkerRole Cancellation

Blog Post: [Azure Worker Role - Exiting Safely, LessThanDot.com] (http://blogs.lessthandot.com/index.php/DesktopDev/MSTech/azure-worker-role-exiting-safely)

This project is a pair of Azure Worker Roles to show the difference in behavior between the out-of-the-box sample code Microsoft provides for a Worker Role and one that has been written to exit safely.

The BasicWorker is what Visual Studio provides when you create a new worker role project. It has a while(true) run loop that uses a thread.sleep call to sleep in between work. I added additional output, a fake DoWork call to simulate some work- load and an OnStop override to log when the stop gets called.

The SafeWorker uses a cancellation token and "ready to exit" token to ensure that in progress work is completed safely before the worker exits.

About

Sample code for a blog on cancelling Azure worker roles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages