SagaCreationException causes are obfuscated
See original GitHub issueWhile developing a toy application I encountered a problem with saga creation. The exact problem was difficult to determine because of the exception handling hierarchy and minimal log output from the framework. For instance, the only feedback from Axon is from a log message produced by DefaultCommandGateway
that looks like:
$ 2018-08-23 15:17:38.761 WARN 64992 --- [nio-8080-exec-3] o.a.c.gateway.DefaultCommandGateway : Command 'com.example.command.StartRegistrationCommand' resulted in org.axonframework.eventhandling.saga.repository.SagaCreationException(An error occurred while attempting to create a new managed instance)
After digging around the source code and not finding anything that would log the underlying cause, I went ahead and installed a patch in my local Maven repository to afford myself more verbose log output (because I’m a bad debugger). I added a logger and some output in the AnnotatedSagaRepository::doCreateInstance
method since that appears to be closest to the exception. Turns out, I didn’t have an EventScheduler
bean in my Spring Application context, of which the saga had a dependency on.
Maybe this is by design, or I’m missing something altogether, but I would expect some way to learn about the underlying cause of a saga not being able to be created via some log output from Axon.
Finally, and this is unrelated to the aforementioned issue, but is it also by design that the axon-spring-boot-autoconfigure
module doesn’t setup a SimpleEventScheduler
bean by default?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
Completely correct @mattupstate! I can assure you we will work on this so that future users will not run into the same issues you ran in to.
The reason the exception isn’t logged in its full “stacktrace glory” is because the result is also returned as part of the
commandGateway.send
method. The completable future there will complete exceptionally, providing you with all details. We do not want to log stack traces when we return them, to prevent log pollution.So I don’t think the framework itself should do anything more than it’s currently doing.