Question

I was using AzureQueue to communicate between roles. My messages like "GoToMaintenanceMode", "StopSendingEmails", "DoNotAcceptRequests" etc. But I realized that, it won't work for my scenario when I have multiple instances due to queue message will shows up only 1 instance at a time.

So my question is beside the options below is there an elegant way to handle this issue something like Role.AllInstances.Run() etc.?

the method I'm using it right now: instance peeks the message, adds it's own instance id to the message and puts it back to the queue, and does not peek the message if it contains it's own instance id.

P.S. I do not want to implement TCP listener, asking for native solution if there is one.

Was it helpful?

Solution

You could use Windows Azure Service Bus Topics/Subscriptions instead of queues. They support multicasting (i.e. multiple receivers).

A short how-to guide can be found here

http://www.windowsazure.com/en-us/develop/net/how-to-guides/service-bus-topics/

Basically, your queue would become a Topic all your instances would become Subscriber to the Topic.

OTHER TIPS

As you do not want TCP listener option or Service bus option. How about extending your same idea with multiple queues. Instance1 will read from Queue1 and Instance2 will read from Queue2 and so on. The only thing you need to handle is the number of queues and simultaneous adding of queue messages to all the queues.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top