0

I am newbie with Aure Queue service. According the examples which I've seen, there are 2 methods to retrieve messages, getMessage and getMessages. The worker role has a while loop which try to retrieve 1 or more messages per cycle. If there are no messages, it sleeps for a moment. For queues which do not contain a lot of messages it is not a good solution, because you have to pay for a lot of queue calls which returns a null value. Is it a way to use Aure Queue service as a producer-consumer, which the worker role would be awaken by a trigger after the queue received a message?, or is it a way to define an event in the worker role which the queue could invoke after receiving a new message? May be using Azure functions?

Gabriel Bursztyn
  • 656
  • 8
  • 24

1 Answers1

1

The Azure WebJobs SDK does offer such a pattern (trigger a function run on new message) -- https://github.com/Azure/azure-webjobs-sdk, however it's still implemented as a while loop, it's just more elegant to work with.

In essence, there is no push mechanism for Azure Storage Queues. Everything is a pull, SDK or no SDK. Just grab a bucket of messages for every run. 32 messages instead of one. Be chunky, not chatty.

Referencing my answer to a similar question for the really great Azure Storage Queues videos by Mark Simms that it links to: https://stackoverflow.com/a/38036911/4148708

Community
  • 1
  • 1
evilSnobu
  • 24,582
  • 8
  • 41
  • 71