NServiceBus
NServiceBus copied to clipboard
Notification event for discarded messages
It is possible to subscribe to recoverability related events like:
- when a message is retried with an immediate retry
- when a message is retried with a delayed retry
- when a message is moved to the error queue
This covers all options from the RecoverabilityAction type except for the newer RecoverabilityAction.Discard which has no corresponding event for users to subscribe to.
As a workaround, it is possible to observe the RecoverabilityContext.RecoverabilityAction in a custom behavior on the IRecoverabilityContext stage after next() has been invoked (as the action will be locked/frozen once it reached the end of the pipeline). The acceptance testing framework is using this approach for tracking inflight messages too.