Wednesday 15 September 2010

azure - Invoking a simple worker role -



azure - Invoking a simple worker role -

i'm trying gain understanding , experience in creating background processes on azure.

i've created simple console app , converted azure worker role. how invoke it? tried utilize azure scheduler looks scheduler can invoke worker role through message queues or http/https.

i never thought type of communication thought create background process not communicate other app. need convert worker role web role , invoke using azure scheduler using http/https?

worker role has 3 events:

onstart onrun onstop public class workerrole : roleentrypoint { manualresetevent completedevent = new manualresetevent(false); public override void run() { //your background processing code completedevent.waitone(); } public override bool onstart() { homecoming base.onstart(); } public override void onstop() { completedevent.set(); base.onstop(); } }

the moment run/debug console converted worker role. first 2 (onstart & onrun) fires in sequence. in onrun have maintain thread alive, either using while loop or using manualresetevent background processing code live.

onstop fired when either release thread onrun or un-expected goes. place dispose objects. close unclosed file-handles database connection etc.

azure azure-worker-roles azure-scheduler

No comments:

Post a Comment