SpringBoot Application with AxonServer and DisruptorCommandBus

I’m check documentation but I’m not found anything how configure AxonServerCommandBus to use DisruptorCommandBus implementation

Is possible to have example of configuration!?

Thanks

Hello Marco,

AxonServerCommandBus is a distributed command bus. It is using SimpleCommandBus as localSegment to handle incoming commands on different JVM’s by default.

AxonServerCommandBus is configured to use this localSegment (Simple command bus by default) in spring boot autoconfiguration: https://github.com/AxonFramework/AxonFramework/blob/master/spring-boot-autoconfigure/src/main/java/org/axonframework/springboot/autoconfig/AxonServerAutoConfiguration.java#L105

By specifying DisruptorCommandBus as a localSegment in your spring boot configuration you should be able to 'override` default behavior and use DisruptorCommandBus instead of SimpleCommandBus:

@Qualifier("localSegment")
@Bean
public DisruptorCommandBus commandBus(TransactionManager txManager, AxonConfiguration axonConfiguration) {
    DisruptorCommandBus commandBus =
            DisruptorCommandBus.builder()
                               .transactionManager(txManager)
                               .messageMonitor(axonConfiguration.messageMonitor(CommandBus.class, "commandBus"))
                               .build();
    commandBus.registerHandlerInterceptor(new CorrelationDataInterceptor<>(axonConfiguration.correlationDataProviders()));
    return commandBus;
}

Best,
Ivan

Thanks Ivan.

I add some code but I’m not add “localSegment”