[axonframework] How to properly use a Interceptors on Axon 3?

Hi Mike,

You can register MessageHandlerInterceptors to your command bus by using the registerHandlerInterceptor() function.
The UnitOfWork in it’s turn contains anything you need to be specific on when you want to do something.
If you’d for example want to add the tenantId only on CreateAggregateXCommands, you can retrieve the command from the UnitOfWork by calling getMessage(), checking if the payload type of the message is CreateAggregateXCommand and if so call message.withMetaData(Collections.singletonMap(“TENANT_ID”, tenantId).

Hope this helps.