As noted in the previous section, sometimes we will do something in a message handler relating directly to the messaging infrastructure, independent of business logic or data access.
For whatever reason, we might need to not only stop a message in the current handler, but stop all pending handlers from executing as well, normally because of a message authorization scheme. In order to do that, we simply call this method:
IBus.DoNotContinueDispatchingCurrentMessageToHandlers();
When we call this method, the message is consumed successfully, and the ambient transaction will be committed. We are just electing to stop running additional handlers on it.
Sometimes, we cannot process a message immediately and need to wait just a little bit. We can instruct the bus to put the message back on the queue, essentially moving it to the back of the line:
IBus.HandleCurrentMessageLater();
However, if the queue is empty at that moment, we will just wind up processing...