Reputation: 301
Does anyone have any example scripts to generate a scenario whereby messages are RECEIVED from a service broker queue but not removed from it. We think we are experiencing this from time to time in production, but can't replicate it locally at all.
Upvotes: 1
Views: 92
Reputation: 2266
If you receive message in transaction and then commit transaction, message is removed from the queue (unless retention = on, but with retention message changes its state).
But if you receive message in transaction, do something with it and rollback transaction then message stays in the queue.
In your case it could be possible that there is some not handled exception that causes this behavior (and not all events in your code is in the same transaction that receives message).
Upvotes: 1