How to configure AsynchronousEventProcessingStrategy


i want to use the AsynchronousEventProcessingStrategy

but can’t find a way to configure it.

Can anyone tell me how to configure it.

Best regards

Hi Patrick,

I deleted my previous post as it was not complete.

So you first need to register an subscribing event processor with async strategy:


class AxonEventHandlerConfiguration {

    public void configureEventHandlers(EventHandlingConfiguration ehConfig, ThreadPoolTaskExecutor executor, TransactionManager axonTxManager) {
        ehConfig.registerEventProcessor("myAsyncSubscriber", (configuration, name, eventHandlers) -> {
            final SubscribingEventProcessor processor = new SubscribingEventProcessor(name,
                    new SimpleEventHandlerInvoker(eventHandlers,
                            configuration.getComponent(ListenerInvocationErrorHandler.class, LoggingErrorHandler::new)),
                    new AsynchronousEventProcessingStrategy(executor, new SequentialPerAggregatePolicy()),
                    configuration.messageMonitor(SubscribingEventProcessor.class, name));
            processor.registerInterceptor(new TransactionManagingInterceptor<>(axonTxManager));
            return processor;



The fist parameter of registerEventProcessor() call is the name of the event processor. That name must also be referenced on the component containing the event handler method:


public class SomeListener {

   public void noEvent(...) { }


Enter code here…


Hey Benoit,

this works fine.
Thank you for that.

Do you know if its possible and if it makes sense to disable the Direct … Strategy for all . events ?

I’m just wondering if it makes sense to dstribute all events over amqp and do alle the event handling and event sourcing over amqp too.

Maybe you have some experience with that ?

BEst regards

Hi Patrick,

Yes it is possible to register a custom default processing strategy. Have a lookat EventHandlingConfiguration#usingTrackingProcessors. It registers an event processor factory.
That’s probably what you should do too.
Does it make sense? That’s a different thing. It could make sense it the processing is expensive or slow. The overhead of switching to another thread must be worth it.
I would not default to an async processing strategy no. But I’m sure you will find more extensive discussions on this subject in the forum.