Hi everyone.
I’m creating a POC based on Axon framework. It’s been a rough start, but thanks to couple debugger sessions I’m finally able to send command/event for one aggregate.
But just after moving forward and trying to do anything more useful I run yet on another bunch of problems.
I would appreciate if more experienced colleagues could please shed more light on this…
Axon: 4.2
Spring Boot 2.1.6/2.2.0
Setup: Boot-autowired JPA-driven stores + event source store + Disruptor command like this:
(…) = abbreviation for clarity in post below
@Bean
public CommandBus customCommandBus(TransactionManager txManager, AxonConfiguration axonConfiguration) {
DisruptorCommandBus commandBus =
DisruptorCommandBus.builder()
.transactionManager(txManager)
.messageMonitor(axonConfiguration.messageMonitor(DisruptorCommandBus.class, "commandBus"))
.build();
commandBus.registerHandlerInterceptor(new CorrelationDataInterceptor<>(axonConfiguration.correlationDataProviders()));
commandBus.registerHandlerInterceptor(new LoggingInterceptor());
commandBus.registerDispatchInterceptor(new LoggingInterceptor());
return commandBus;
}
Problem 1:
I have one @Aggregate: Engine. Flow is as follow: send CreateEngineCommand(“a”) to @CommandHandler constructor, then work with created Aggregate and send some more commands like AcceptItemCommand
When I execute this flow from a Spring @Component public class AxonTester implements CommandLineRunner run(), everything works properly and events are stored in the evenstorage
But when I try to do initialization of this aggregate (so sending CreateEngineCommand) from another @Component during application startup:
@Component
public class AxonIOFactory
{