@Bean
public EventStore eventStore() {
final EsEventStore esEventStore = new EsEventStore(new EventStoreClient(new EsContextDefaultImpl(EventStoreSettings.withDefaults()
.host("http://127.0.0.1:2113")
.build())));
return esEventStore;
}
Since I'm using JPA to persist the data to a postgresSQL database I got an error saying I needed an EventBus (assuming axon spring boot starter configuration detected this), so I added to the same config file:
// Since EventStore extends EventBus, now we have 2 buses
@Bean(name = "eventBus")
public EventBus eventBus() {
return new SimpleEventBus();
}
The code now compiles and runs fine and I can submit requests to the API and see the events being generated in the Event Store!
The problem is that I can't get the data to be persisted to the SQL database... I have an event listener class like this:
@Component
public class MyEntityEventListener {
private MyEntityRepository repository;
@Autowired
public MyEntityEventListener(MyEntityRepository repository) {
this.repository = repository;
}
@EventHandler
public void on(MyEntityCreatedEvent event) {
// THIS CODE IS NEVER EXECUTED :( :( :(
repository.save(...);
}
}The event handler is never fired :(I commented the configuration file, so that I only use the postgresSQL db for both event souring and data persistence and it get's fired... (assuming that's because there is only one EventBus in this scenario).Any insights on how get the handler to fire when there are 2 EventBuses?Regards,Bruno
@Bean
public EventStore eventBus() {
final EsEventStore esEventStore = new EsEventStore(new EventStoreClient(new EsContextDefaultImpl(EventStoreSettings.withDefaults()
.host("http://127.0.0.1:2113")
.build())));
return esEventStore;
}
--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
- siamak