Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is there no "Remove message from queue" when resubmitting a message to a different queue #771

Open
dmathijs opened this issue Feb 27, 2024 · 5 comments
Labels

Comments

@dmathijs
Copy link

Hi,

We have a use-case in which we have a error and a audit queue next to our regular queue. We would like to be able to re-submit some of the messages from the error queue and delete them (without purging the whole error queue).
This possibility exists when resubmitting from a DLQ but not from another regular queue.

Is there a technical reason this was not added? Would you mind if we try adding support for it?

@SeanFeldman
Copy link
Collaborator

I don't remember off top of my head, but if you select Repair and Resubmit Message, the popup should have Remove from DLQ. If you do that when resubmitting from an error or audit queue, will it remove the message? If yes, it could be just a naming bug.

@ErikMogensen
Copy link
Collaborator

I wrote about it in the PR for that capability, #192 . What may not clear from that text is that all messages in front of the one that you want to delete will have their Delivery count incremented. The default setting is that when the Delivery count reaches 10 the message will be moved to the deadletter subqueue.

That means that suddenly you may end up with messages on the deadletter subqueue.

I think that this capability has been requested for the normal queue once or twice before and it seems to have performed well since it was implemented five years ago. So in my opinion it should be added for normal queues as long as there is a warning that all messages in front of the message(s) that are to be deleted will have their Delivery count increased and that may lead to them being moved to the deadletter subqueue.

@SeanFeldman
Copy link
Collaborator

It's already showing on a regular queue as well. that's why I'm confused.
image

So in my opinion it should be added for normal queues as long as there is a warning that all messages in front of the message(s) that are to be deleted will have their Delivery count increased and that may lead to them being moved to the deadletter subqueue.

Now, that is a hazardous thing IMO. Do you happen to remember the details of why a message must be received rather than peeked?

@ErikMogensen
Copy link
Collaborator

It's already showing on a regular queue as well. that's why I'm confused.

Yeah, I saw that as well. I think that's a regression issue (since I cannot have create that bug 😄 ).

Do you happen to remember the details of why a message must be received rather than peeked?

Yes, and for that I qoute MikeWo's answer on StackOverflow

The Peek and PeekBatch operations only return the messages and does not lock them at all, even if the receivedMode is set to PeekLock. It's mostly for skimming the queue, but you can't take an action on them. Note the docs for both Abandon and Complete state, "must only be called on a message that has been received by using a receiver operating in Peek-Lock ReceiveMode." It's not clear here, but Peek and PeekBatch operations don't count in this as they don't actually get a receive context. This is why it fails when you attempt to call abandon.

I know I initially tried to use Defer() but couldn't get it to work. MikeWo mentions another Stackoverflow thread where that is mentioned, How to use the MessageReceiver.Receive method by sequenceNumber on ServiceBus. It would be interesting to know it it is possible to use that instead.

@SeanFeldman
Copy link
Collaborator

Let's revisit what we do. I just realized that resubmitting a message we receive increases the delivery count. For clients that have MaxDeliveryCount on the entities set to something fairly large, it doesn't pose a problem. But for those who have it set to a relatively small value, risking DLQ messages as a side effect of resubmitting doesn't sit well with me. Let's start from revisiting how the implementation is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants