Hi,
I'm building a simple application just to learn about CQRS and Axon
framework.
I have a main class where I'm initializing command and event bus.
Command is executed successfully and event is persisted, but event
listener doesn't fire.
CommandBus bus = new SimpleCommandBus();
SimpleEventBus eventBus = new SimpleEventBus();
FileSystemEventStore eventStore = new FileSystemEventStore(new
XStreamEventSerializer());
try {
eventStore.setBaseDir(new UrlResource("file:/base_dir_path"));
} catch (MalformedURLException e) {
e.printStackTrace();
}
bus.subscribe(CreateCustomerCommand.class, new
CreateCustomerCommandHandler(eventBus, eventStore));
bus.dispatch(new CreateCustomerCommand());
AnnotationEventListenerAdapter listener = new
AnnotationEventListenerAdapter(new CustomerCreatedEventHandler(),
eventBus);
listener.subscribe();
My event listener is a simple POJO:
public class CustomerCreatedEventHandler {
@EventHandler
public void handleContactCreatedEvent(CustomerCreatedEvent event) {
System.out.println("Customer created");
}
}
Please , tell me what Im doing wrong.
Cheers,