I’ve been upgrading to Axon 4 today. A lot of packages seems to have moved around (new package names), but I think it’s more logical and I managed to refactor most of my code.
We are using MongoDB as an event store and token store. All my unit tests work again, but when I start the application, all my sagas try to connect to Axon server for looking up their tracking tokens.
I get these errors in my logs:
o.a.e.TrackingEventProcessor - Fetch Segments for Processor ‘EnrollEmployeeToPPVDSagaProcessor’ failed: No connection to AxonServer available.
So how do I exclude AxonServer (for now) and make MongoDB my event and token store again?
I use to have this in my config class:
@Bean
public SagaConfiguration enrollEmployeeFromPPVDSagaConfiguration() {
return SagaConfiguration.trackingSagaManager(EnrollEmployeeFromPPVDSaga.class);
}
good to hear that you’ve adopted 4.0! It’s been out for more than a day, already ;-).
If you wish to use the embedded event store, you basically have two options:
explicitly define the EmbeddedEventStore in your application context. This approach will allow you to use the event and query bus by Axon Server.
exclude the axon-server-connector dependency in your pom/gradle file. This will give you the defaults you were used to in Axon 3.
I have a simple Spring Boot application that I am trying to convert to Axon 4.0 to run without a separate Axon Server instance.
I can exclude the axon-server-connector dependency but I do not understand what you mean by explicitly define the EmbeddedEventStore in your application context. The only explicit configuration in my app is to serialize events using JSON. It (by default) stores events in an H2 database defined by spring.datasource.
SInce we only use MongoDB as our eventstore, I can only give you this. All non-AxonDB event storage engines have a builder interface now.
Our config for mongo looks like this:
So I guess, for the JPA evenstorage engine it would look like this:
`
@Bean
public EventStorageEngine jpaEventStore() {
return JpaEventStorageEngine.builder()
.build();
}
`
Just check out which stuff you have to set on the builder interface to define your datasource, entitymanager etc (intellisense get’s you a long way to see what’s possible).