I’ve been trying to implement IHandleSagaNotFound interface to catch and log all commands and messages that can’t be handled by Saga or handlers. The problem is that I can’t seem to get the Handle on IHandleSagaNotFound to be executed when an unknown ICommand is sent to the endpoint.
To test it outside our production code, I
- downloaded NServiceBus sagas: Saga basics • Particular Docs
- Added “UnknownCommand : ICommand” in the Messages project
- In the ClientUI project Routed the UnknownCommand to Sales endpoint
- Created “SagaNotFoundHandler : IHandleSagaNotFound” in the Sales project (Sagas Not Found • NServiceBus • Particular Docs
- Sent the UnknownCommand from the ClientUI
- All I get in the Sales project console is
15:41:35.051 INFO Immediate Retry is going to retry message '153c6f30-669c-4500-b092-af0100d11e2d' because of an exception: System.InvalidOperationException: No handlers could be found for message type: Messages.UnknownCommand
I had an assumption that IHandleSagaNotFound’s Handle method should be called instead.