1

I understand that GetMessages and PeekMessages have a limitation of 32 messages. That's the maximum amount they can retrieve.

I have a storage queue that has over 50 messages and I would like to retrieve, and process them all at once. Is it possible to do this?

I'm guessing that with GetMessages you can retrieve the first 32, and change the dequeue count, and then make another call and retrieve the next 32, and change the dequeue count, etc but I was wondering if there's a way how to get them in batches without affecting the dequeue count.

For example, say I wanted to update/delete the last message that was added (last out of say 65 messages) how can I go about and do this without affecting the other 64 messages?

Thanks in advance

bonnu18
  • 75
  • 1
  • 11

1 Answers1

1

Simple answer to your question is that you can't.

You mentioned that you want to update/delete a message (last one). In order to do that, first you would need to dequeue all messages (call GetMessages) and that will change the dequeue count of the messages fetched.

Peeking the messages will not help either because peeking the messages does not change the messages visibility and you will get same messages over and over again (assuming not other process has dequeued some of the messages).

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Thanks for your answer. In that case I will write my own method to perform such operation. Lastly, once a message was dequeued, is it possible to update the dequeue count again to give the impression that it was never retrieved/manipulated? Got a feeling that this isn't the right way of doing things. – bonnu18 Jun 11 '19 at 09:35
  • `is it possible to update the dequeue count again to give the impression that it was never retrieved/manipulated` - The answer is no. It is a system defined property and you can't manipulate that. One possible thing you could do is dequeue the message, create a new message using this dequeued message's contents and then delete this message. But this is prone to error as you'll be performing 2 operations - create and delete and either of them can fail. – Gaurav Mantri Jun 11 '19 at 11:15
  • Thanks for your answer Guarav Mantri. Hopefully new options will be released in the future as it's quite limiting at the moment (in my opinion). – bonnu18 Jun 11 '19 at 11:22
  • 1
    I doubt that it will change. Do take a look at Azure Service Bus if you need advanced messaging capabilities. – Gaurav Mantri Jun 11 '19 at 11:24