Queue Polling In Azure

In a previous tutorial we showed how to create and receive a message from queue , we can now adding polling

The MessageQueue class in StorageClient contains the polling inbuiltĀ  infrastructure and delivers the message via eventing:

mqObj.MessageReceived += new MessageReceivedEventHandler(mqObj_MessageReceived);
mqObj.PollInterval = 1000; // poll interval in milliseconds
mqObj.StartReceiving(); // starts polling

The event handler fires whenever a message is received, in addition, when there are no more messages the client will begin polling the queue at theĀ  PollInterval

In this code sample no timeout is set and so the default is selected from the Timeout property of the MessageQueue class (which in turn defaults to 30 seconds).

Related Articles:

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

No comments yet... Be the first to leave a reply!