-
Notifications
You must be signed in to change notification settings - Fork 10
DefinitionException for CommandBus producer #21
Comments
@hwellmann - I observed this too. Is there a way to use a CDI concept (I thought this should be a An alternative is to let the container produce beans and and retrieve the beans using the BeanManager. This would mean, that the entire Axon Configuration startup needs to be executed after the CDI is up and running. In doing so, the portable extension would only collect the annotated producer methods and provide defaults in case there are none and the entire wiring must happen AFTER the CDI is up and running using some late application event. Does this make sence, then? (Just to explain the idea behind current code: in Spring it is ok to hook up into the BeanFactory and call producer methods...) |
Simon, what you suggested is indeed one of the very approaches I am trying to pursue. Unfortunately it is not that simple since we need to make some beans injectable ourselves including repositories and saga factories that are not just static definitions but dynamic, with a parameterized type and inside a loop. In addition, we need to actually build or start the configuration before we an make the beans injectable. It is a tough circular reference situation that hopefully can be solved. I am trying to unravel it, but PRs solving the issue are welcome. In the worst case, we may need to say that for some types of customizations like the command bus, you must also supply and manage your own configuration reference. Hopefully it won't come to that. |
Sorry to be late to this party, but I think this discussion can be solved as follows: The recursive dependency issue (also commented on by Mark in Now applications can add producers for a customized command bus, which will be picked up by the CDI extension, without referring to the configuration-to-be. Then remains the problem of ensuring that it is a singleton, but that is an issue for the BeanManager, which we are currently circumventing by calling the producer directly in |
Using the following producer method for CommandBus
my application fails to start with a
DefinitionException
This is one of the issues I mentioned in #7. The
CommandBus
producer method should not be invoked explicitly by the extension. The invocation fails since theConfiguration
bean to be injected is not yet available at this stage.The text was updated successfully, but these errors were encountered: