CorrelationDataProvider in axon3

Hello, how to register CorrelationDataProvider for sagas?

in axon 2.4 it was something like this:

@Bean
AnnotatedSagaManager accessorAccountSagaManager(SagaRepository sagaRepository, EventBus eventBus, SagaFactory sagaFactory,
      CorrelationDataProvider correlationDataProvider) {
   AnnotatedSagaManager sagaManager = new AnnotatedSagaManager(sagaRepository, sagaFactory, AccessorAccountSaga.class);
   sagaManager.setCorrelationDataProvider(correlationDataProvider);
   eventBus.subscribe(sagaManager);
   return sagaManager;
}

but in axon 3 I can see the registration only on UnitOfWork

Thanks

Hi,

In Axon 3 you can register your correlation data providers directly on Axon’s configuration builder. See Configurer#configureCorrelationDataProviders(…).

Not only is correlation data copied over to commands when dispatched from a saga, but any message created in the context of a unit of work will get the correlation data in Axon 3. I.e. this now works any time.