Reputation: 303
I can't find in Azure documentation how to find out when the new message is waiting for my service, which will make use of it.
One option is to use async method forever, but it does not seem to be an elegant solution.
Is there any "right" way of doing this?
Upvotes: 1
Views: 222
Reputation: 389
Azure Queues don't by themselves trigger anything. As noted by Martin Brandl, you can use a queue trigger in an Azure Function. Functions are pretty cool, and would work perfectly in this case. The function is triggered and can pass the queue message in to the function, where you would have it call your service. I think you can write the function in Node (javascript), too, if you want to.
Otherwise, the original pattern for using queues was to write to them, and then have a process that loops pretty much infinitely and looks for messages on the queue. When it finds one, it would process it and then delete it from the queue, and try to read the queue for another message.
Upvotes: 1
Reputation: 58931
In Azure Functions you can use a queue trigger so your function get triggered if there is a new message in the queue. You could use that to invoke a message on your service but I doubt this would be better then using the async GetMessageAsync() which I believe has a 90 second timeout in a loop.
Upvotes: 1