[axonframework] Distributed Command Bus usage

Hi Mike,

yes, we do recommend using the command bus (as well as the other buses) when dispatching messages to other services. This gives you true “location transparency”, and enables you to move logic in and out of services and have your messages be automatically distributed correctly when running multiple instances of a service.

When messages are serialized, the message type and revision are also attached. By default, these are the fully qualified class name of your message’s palyoad. You can change this, however. In XStream, you can configure package and class aliases. In the JacksonSerializer, you can override the “classForType” and “typeForClass” methods, to implement the mapping from class to message type and vice versa.

Cheers,

Allard

Thank you for the direction, Allard.

What I’ve done is I created a shared library that contains all the commands and events that the Axon microservices use; it essentially serves as the API for the distributed system. Does this approach make sense? That’s what I’ve gathered from the numerous reference materials I’ve been looking at.

Loving the framework so far. Currently POCing it for a project.

Hi Miko,

sharing jars with classes does make sense, in many situations. However, it is important to realize that the “contract” you have between services is based on the serialized form, not the classes.

Kind regards,

Allard Buijze