How to make AsynchronousEventListener working?

Currently I am using axon_1.2.1 to develop an application. From the
document I noticed that Axon supports asynchronous event handlers.
The set up seems to be simple by using Annotation. However no matter
what I tried, it seems to be not working.

Here is what I do. I annotate one of my event handle class as:

@Component
@AsynchronousEventListener(sequencingPolicyClass =
FullConcurrencyPolicy.class)
public class ProfileSetEventHandler
{
}

I got "no executor" error on AsynchronousEventListener. By checking
the axon source code, it seems to me that
"AnnotationEventListenerBeanPostProcessor" needs to inject an
Executor. I added the injection in the Spring Context xml file to
the AnnotationEventListenerBeanPostProcessor bean. No working. And
I noticed that

Somehow my previous message is send before it finished.

I notice that AnnotationEventListenerBeanPostProcessor is a
postProcessor bean and the injection is working.
The AnnotationEventListenerBeanPostProcessor is created before the
executor bean on the Spring container.

Am I missing something in here? Can someone give me an working
example?

Dave

Hi Dave,

do you use <axon:annotation-config /> to enable annotation support in your spring context? If so, you need to configure the executor on that element, instead of adding an additional AnnotationEventListenerBeanPostProcessor.

For an example, checkout the following two files:
https://github.com/AxonFramework/AxonFramework/blob/master/integrationtests/src/test/resources/META-INF/spring/async-command-loopback-context.xml
https://github.com/AxonFramework/AxonFramework/blob/master/integrationtests/src/test/java/org/axonframework/integrationtests/loopbacktest/AsynchronousLoopbackEventHandler.java

Cheers,

Allard

It works. Thanks Allard.

Best Regards
Dave,