How to subscribe event listener in axon-3.0-M1

hi, all

when i use axon-spring 3.0-M1 with spring boot, the event listeners (EventHandler) do not be subscribed in event bus.

found the code as following :

public class MessageHandlerSubscriberDefinitionRegistrar implements ImportBeanDefinitionRegistrar {

@Override
    public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
        MultiValueMap<String, Object> attributes = metadata
                .getAllAnnotationAttributes(EnableHandlerSubscription.class.getName());

if (Boolean.TRUE.equals(attributes.getFirst("subscribeEventProcessors"))
                >> Boolean.TRUE.equals(attributes.getFirst("subscribeEventListeners"))) {
final GenericBeanDefinition definition = new GenericBeanDefinition();
            //definition.setBeanClass(EventListenerSubscriber.class);   
            final Object eventBusRef = attributes.getFirst("eventBus");
if (!"".equals(eventBusRef)) {
                definition.getPropertyValues().add("eventBus",
new RuntimeBeanReference((String) eventBusRef));
            }
            registry.registerBeanDefinition("EventListenerSubscriber", definition);
        }

if (Boolean.TRUE.equals(attributes.getFirst("subscribeCommandHandlers"))) {
final GenericBeanDefinition definition = new GenericBeanDefinition();
            definition.setBeanClass(CommandHandlerSubscriber.class);
            registry.registerBeanDefinition("CommandHandlerSubscriber", definition);
        }
    }
}






Configuration code in spring boot application as following:

Hi,

Until we have spring (auto) config working properly you’ll need to register them manually.

To do so you’ll have to register the listeners with a new EventHandlerInvoker and then create an EventProcessor that delegates event handling to the invoker.

There are 2 forms of EventProcessors, one that subscribes to events (the old way) and one that tracks the event store (the new and recommended way). The latter variety keeps track of where it is using a tracking token that it stores each time a batch of events is processed.

To set up tracking use this:

TrackingEventProcesssor eventProcessor = new TrackingEventProcesssor(new SimpleEventHandlerInvoker(“name”, listeners), eventStore, tokenStore);

And then, when your application has started invoke: eventProcessor.start();

Obviously, when 3.0 final is out you won’t have to do this all by hand :).

Good luck,
Rene