Axon 4 without AxonServer

Hi,

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);
}

But this doesn’t work anymore.

Thanks,

Danny

Hi Danny,

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.

Cheers,

Allard

Hi Allard,

I just excluded the axon-server-connector and everything seems to work again like before. So thanks :wink:

Kind regards,

Danny

Where do you get Axon 4 documents and download. I could not find it http://www.axonframework.org/download/

Hi Ajinkya,

we’re working on transitioning the website from axonframework.org to axoniq.io. You can download Axon (and Framework and Server) from https://axoniq.io/download.

Cheers,

Allard

Or just update your maven/gradle dependencies :wink:

Hi Allard

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.

Any help you can give me is greatly appreciated.

Thanks
Michael

Hi David

Thanks, that works fine with in-memory event storage. I can replicate that in my own app as well.

I need to figure out how to replicate the default JPA event storage in Axon 3. It is not clear to me from the Axon docs.

Regards
Michael

Hi Michael,

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:

`

@Bean
public EventStorageEngine eventStore(MongoClient client) {
return MongoEventStorageEngine.builder()
.mongoTemplate(defaultAxonMongoTemplate())
.build();
}

`

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).

Hope this helps :wink:

Danny

Thanks everyone for your help.

It is now working with only changes to the POM and package arrangements. I don’t know why it didn’t work before.

The code is here, if you are interested: https://github.com/mjstrasser/licensing-demo