Split command and query in two microservices (Axon 3)


I just start working with Axon 3 and have read all the documentation in the web but still have a very stupid but important doubt for me,

  1. How can i split in two apps/microservice/JVM the Command and Query API?
  2. I have read that EventStore is the Storage+EventBus so if my Query side need to handle events need to use the same EventStore but How?
  3. I mean, the EventStore is a object in memory in Axon Framework so how can i share between Apps? should i just setup the same data source (same data base) for both applications?
  4. Any example projects that implement this please?

Best Regards.

Hi Jorge,

I ran a live coding webinar a few weeks ago which shows this exact scenario, splitting up a monolith in a command side and a query side (and a gui).

Youtube: https://www.youtube.com/watch?v=3NmMDUlPkgw, Github: https://github.com/fransvanbuul/gc-webinar

Regarding 2/3: yes, in general, to make sure that the command handler can publish events that are read by the event handlers in the query side, you would configure EventStore implementations at both sides that point to the same database. In the live coding session I referenced above, this is a connection to a single AxonDB cluster through AxonHub, but alternatively could also be an RDBMS or Mongo.

Kind regards,

Hi Frans,

Thanks for the video has been very instructive :-), seeing the code i have some more questions:

1.- It is needed to put in the query side the “Tracking event processor” for make the solution work? or could be a “Subscriber Event processor”?
2.- Using the same datasource for two instances of the EventStore (in two different JVM) ca not cause problems? i mean concurrency problem?

Best Regards.

Hi Jorge,

Glad to hear it was useful.