Axon 5 cannot read events without revision

Hi

I am migrating my AF4 apps to AF5. For whatever (historical) reasons we have quite some events in our AxonServer eventstores that do not have a revision defined. This worked fine with AF4. With AF5 we get an error when reading events that do not have a revision:

Caused by: java.lang.IllegalArgumentException: The given version is unsupported because it is empty.
at org.axonframework.messaging.core.MessageType.lambda$new$0(MessageType.java:64)
at org.axonframework.common.Assert.assertThat(Assert.java:117)
at org.axonframework.messaging.core.MessageType.(MessageType.java:61)
at org.axonframework.messaging.core.MessageType.(MessageType.java:101)
at io.axoniq.framework.axonserver.connector.event.AggregateBasedAxonServerEventStorageEngine.convertToMessage(AggregateBasedAxonServerEventStorageEngine.java:267)
at io.axoniq.framework.axonserver.connector.event.AxonServerMessageStream.toSimpleEntry(AxonServerMessageStream.java:73)
at io.axoniq.framework.axonserver.connector.event.AxonServerMessageStream.next(AxonServerMessageStream.java:67)
at org.axonframework.messaging.core.FilteringMessageStream.fetchNext(FilteringMessageStream.java:58)

We are using the AggregateBasedAxonServerEventStorageEngine because we do not yet want to migrate our eventstores to DCB.

Are there any configurations I am missing or are there any workaround?

My only idea so far is writing AF4 upcasters that set the revision and run a full event transformation over the eventstore.

Klaus

Hi Klaus,

thanks for reporting that. Would you mind reporting a bug with the Axon Framework repository including the Axon Framework version you are using, this sounds like something we want to have a closer look at. I had a quick look at the codebase and the explicit org.axonframework.messaging.core.MessageType introduced for Axon Framework 5 requires the version to be non-null and not empty. When used internally with a different constructor, the version defaults to 0.0.1, but the io.axoniq.framework.axonserver.connector.event.AggregateBasedAxonServerEventStorageEngine#convertToMessage explicitly uses the two arg constructor supplying the type and revision from the event received from Axon Server.

Event transformation (on the event store) as a workaround sounds like an option. Upcasting directly in Axon Framework 5 is not (yet) possible, we have scheduled to work on this for the upcoming 5.2 release.

But I would rather consider this being a bug, with a fix targeted towards the AggregateBasedAxonServerEventStorageEngine - we’ll discuss it in the team and follow up on the github issue.

Hi Jakob,

I created Axon 5 cannot read events without revision · Issue #4625 · AxonIQ/AxonFramework · GitHub .
It would be nice to have a fix for this one.

As a workaround I implemented an event transformation that initializes empty revisons, but this also requires some work to rollout in different event stores and takes time. So a fix in AF5 would of course be better.

Thanks

Klaus

Hi Klaus,

we are considering different directions to fix that, one being that we simply set a default version like `UNDEFINED` or `0.0.0` or `0.0.1` (which is the current AF5 default when omitting the version). I am curious, would such a default version work for your use-case, and if so, would you need to customize it or would it be sufficient if it was some predefined String?

Best Regards,

Jakob

Hi Jakob,
I think a default version should be fine.

Klaus