1
votes

I have implemented two microservices with spring boot axon.

Microservice A contains UserAggregate.

Microservice B contains UserAggregate.

Microservice A able to generate below 2 events in UserAggregate.

1) UserCreatedEvent stored in the event store with 0 sequence of type UserAggregate

2) UserUpdatedEvent stored in the event store with 1 sequence of type UserAggregate

Now, Microservice B would like to generate another event on the same UserAggregate, the event store action is generating from B service

3) UserDeletedEvent need to store in the event store with 2 sequence of type UserAggregate

But I am getting below exception, how can I solve this exception ?org.axonframework.serialization.UnknownSerializedTypeException

2019-09-17 21:46:41.829 WARN 1756 --- [onPool-worker-2] o.a.c.gateway.DefaultCommandGateway : Command 'com.ms.commands.UserDeletedCommand' resulted in org.axonframework.serialization.UnknownSerializedTypeException(Could not deserialize a message. The serialized type is unknown: com.ms.events.UserCreatedEvent (rev. null))

I am using axon 3.3.3 version with spring boot 2. and I am using JdbcEventStorageEngine.

@Bean
public JdbcEventStorageEngine eventStorageEngine(ConnectionProvider connectionProvider) {
return new JdbcEventStorageEngine(connectionProvider, NoTransactionManager.INSTANCE);
    }

In application.properties

axon.serializer.general=jackson
axon.serializer.events=jackson
axon.serializer.messages=jackson
1

1 Answers

2
votes

The fully qualified class name of any message within an application, or a group of microservices within the same Bounded Context, should be known.

Without this, any application would in fact not be able to "understand" the serialized form of a dispatching command, event or query coming in from another application.

From this point it is typically desirable to have a dedicated module/package/repository for your commands (and their potential responses, events and queries (with the query responses). Every project which is part of the same Bounded Context can then depend on this "core-api" package, so that they all know the aforementioned fully qualified class name of any message coming in.