Rest + Axon

Hello
I need to have the rest interface for my aggregates to interaction with external net core services to write properties.
But internal microservices use the commandGateway
Have you best practices way, examples to do it?
I think it should be done without projections.

Hello Георгий,

I’m not sure if I understood you correctly, maybe you can provide more information.

My opinionated approach would be to create a REST controller (adapter). You should inject commandGateway in this controller and dispatch commands.

I have created a sample application that is demonstrating this approach: https://github.com/idugalic/digital-restaurant/tree/master/drestaurant-apps/drestaurant-monolith-rest

This application is exposing capabilities of ‘domain model’ via the REST API components (adapters) that are responsible for

  • dispatching commands - CommandController
  • querying the ‘query model’ (materialized views) - Spring REST repositories
    I create one-to-one relation between a Command Model resource and a Query Model (materialized view) resource. Note that we are utilizing Spring Rest Data project to implement REST API (on the query side), and that will position us on the third level of Richardson Maturity Model

The microservices architectural style for the same domain/problem is available here:

I hope this helps,

Best