kamaladafrica / axon-cdi

Axon Framework CDI Integration
Apache License 2.0
6 stars 1 forks source link

Axon 3 integration should be based on Configurer #4

Open kamaladafrica opened 7 years ago

kamaladafrica commented 7 years ago

In Axon 3, the Configurer interface is introduced. It seems the best and clean way to integrate with CDI

dcdh commented 7 years ago

Hello Alessio, You're right about this enhancement. The best way would be to mimic what Allard has made with the spring project in axon by analysing how to rewrite this code SpringAxonAutoConfigurer.java from Spring to CDI.

I guess the whole part must be defined in the AfterBeanDiscovery handler to produce Repositories and other CDI managed bean (like EventScheduler). The LazyRetrievedModuleConfiguration class should return the bean reference using the beanManager.

In the AfterDeploymentValidation handler we could next build the configuration using configuration.buildConfiguration() and next call configuration.start() to start framework and so threads (like the one used to replay events). I hope that calling buildConfiguration will retrieved bean reference containing in each LazyRetrievedModuleConfiguration (It would be much easier than extending Producer).

We will also need one configuration per qualified CommandGateway (and bean associated to theses qualifiers).

I will work on it this weekend. Hope that I will have enough time to do it (but I doubt).

I'll keep you in touch :)

Regards, Damien

dcdh commented 7 years ago

I've just submit a new pull request using the axon Configurer. Please review.