Hi,
I’m doing some tests with Axon related to exception management. I want to validate things before presenting it as a valid framework for production … Which I hope so
One situation doesn’t make me comfortable for production: how to properly manage the situation of asynchronous commands for which no CommandHandler has subscribed?
Here’s a short description of the use case I’m speaking about:
1/ a command is dispatched by a caller in async. mode (no return code expected) through a CustomCommandGateway,
2/ no CommandHandler has subscribed to it,
3/ the caller doesn’t get any CustomCommandGateway: hence, it has no way to know whether its Command should be processed!
4/ a WARN log message is generated by Axon LoggingCallback.
A workaround is to declare NoHandlerForCommandException as a throwable exception on the method definition in the CustomCommandGateway. But explictelly throwing Runtime exceptions like this, is not eleguant …
So, is there any recommendation to manage properly this situation in production? The only option I foresee now, is to raise alerts from the WARN log message.
In a more pro-active way, can we imagine to check at deployment that all commands have a subscribed CommandHandler before turning the system “on”?
FYI I’m using Axon 2.3.