0
votes

First service adds messages to queue if user does not exist in DB, second service gets message from queue and create user. Possible situation, when first service adds 2 messages for create users before second gets it. How to resolve it? As I understand, no way to review queue...

I use Azure Storage queues

1
Not sure what, exactly, you're asking, but Azure queues don't have a guaranteed order. Why is there an issue publishing two messages to a queue before someone reads the first? This is what a queue is designed for. Also: Please clarify what type of queue you're trying to use, since your tagging is not really very telling. Azure Storage queues? Service Bus queues? Some other non-Azure-specific queue?David Makogon
no guaranteed order? What sense in queue then?Oleg Sh
Storage queues do not provide guaranteed order. Service Bus queues do. But the concept of guaranteed order is not the sole purpose of a queue, unless you absolutely need FIFO (but this isn't the place to debate the merits of order vs non-order guarantee). That's why it's important to clarify the queue type you're using, and the issue you're running into. Please edit your question accordingly.David Makogon
Storage Queues have a lot of documentation explaining why messages might be out of order (e.g. you fail to process and delete a message in the allotted time, so it becomes visible for consumption again; or you have multiple readers). But you cannot count on order in a Storage Queue, as a rule.David Makogon

1 Answers

1
votes

Azure Queue message doesn't support peek-lock to be processed. Once it is read, it becomes invisible. You need to look into Azure Service Bus as it allows you to control message one by one and in order if required.