Implement Axon Logging, Dispatch, Handler and Auditing Interceptors

I am almost done with my application but I am stuck with implementing the interceptors in my application. My goal is to use the Logging, Dispatch, Handler and Auditing Interceptors for better tracking and monitoring. If you have any samples can you kindly direct me to those.


Assuming you use Spring to configure your application, you can use something along these lines:

public CommandBus commandBus(TransactionManager txManager) {
   SimpleCommandBus commandBus = new SimpleCommandBus(txManager, NoOpMessageMonitor.INSTANCE);
   commandBus.registerHandlerInterceptor(new LoggingInterceptor<Message<?>>());
   return commandBus;

Hope this helps,


Thanks Oscar, I am using the CommandGateway instead of command bus. But I will try similar approach with commandgateway to check if that work.