paolosalvatori / ServiceBusExplorer

The Service Bus Explorer allows users to connect to a Service Bus namespace and administer messaging entities in an easy manner. The tool provides advanced features like import/export functionality or the ability to test topic, queues, subscriptions, relay services, notification hubs and events hubs.
MIT License
2.01k stars 585 forks source link

Mass transfer messages from dead letter queue? #758

Closed DerekSMorin closed 6 months ago

DerekSMorin commented 9 months ago

This might be a question or possibly a feature request. If we have a few thousand messages in the deadletter queue, I'm wondering what the best way is to transfer all of them back for reprocessing?

Currently I do something like this:   image

But if we try more than a few hundred messages we frequently get this:

<06:52:05> Not all the selected messages were moved. This was caused by the time to go through the messages were longer than Lock duration for the queue. Either delete some messages in the dead letter subqueue or increase the Lock duration for the queue. The Lock duration for the queue is currently 60 seconds. I realize altering the lock duration could make a difference, but I'm wondering what the recommended approach is? I generally end up doing 100-200 messages at a time but this is manual and time-consuming.
ErikMogensen commented 9 months ago

I see two alternatives.

Either: Set Lock duration to maximum unless you suspect that could cause trouble for clients reading messages from the queue. Maximum Lock duration is five minutes. You may still not be able to send all messages in the same batch. When done set Lock duration back to what it was.

Or: Uncheck Remove message from DLQ and send them all. When done, Purge the Dead Letter Queue (DLQ). Before purging, check that no new messages have arrived in the DLQ. There is a risk that if a message gets moved to the DLQ it would be lost though. You can disable Send to the queue when doing this if you are sure that the sending clients can handle that.

SeanFeldman commented 9 months ago

You can disable Send to the queue when doing this if you are sure that the sending clients can handle that. Risky. Especially when there's no control over senders.

I don't remember the logic to move messages out of DLQ, but it might explain the issue if the code is greedy. Then, the max lock duration on the queue won't help.