AuditingInterceptor in Axon 3.0

Hi,

Yet another “How do I port Axon 2.x -> 3.0 functionality” question:

We use AuditingInterceptor to ensure that any metadata attached to a command is stored as metadata on the events emitted as a result of processing it.

How should we port this functionality to Axon 3.0 ?

Thanks,
Yoram

Hi Yoram,

there is a CorrelationDataInterceptor that allows you to register meta data with the Unit of Work (using registerCorrelationDataProvider(…) ). That MetaData is automatically attached to all messages created in the scope of that Unit of Work.

If you use Spring Autoconfiguration or the Axon Configuration API to define your components, you will get an interceptor that automatically adds a correlationId and traceId to all the messages (see MessageOriginProvider).

Cheers,

Allard

thanks

Hi Allard,
what is the way to register my own CorrelationDataProvider using Spring Boot?

thanks,
Simone.

Hi Simone,

while checking the code for how these things are wired, it seems like there is currently no Spring-friendly way of wiring them. They are provided by the AxonConfiguration, but it there is no way to get them in there using Spring (at least not without doing something ‘dirty’).

It’s a simple change to get them ‘autowired’ based on their availability in the application context.
I have submitted issue #240.

Thanks!

Allard

Thanks!
Did you plan to release the 3.0.1 version soon?
In the meantime I’ll try to fix my issue in the ‘dirty’ way…

Simone.

Yes, 3.0.1 should be available early next week

Perfect!

Thanks,
Simone.