1

When a @SagaEventHandler needs to fetch data from another Microservice that also uses Axon Framework, is it a good practice to use QueryGateway to query another Microservice? Or it is better to use something like RestTemplate to call another Microservice from a @SagaEventHandler method?

Thank you

Lucas Campos
  • 1,860
  • 11
  • 17

1 Answers1

3

In my opinion, you can go any way as both of them have pros and cons.

But, since you are already using Axon, I would go with that because of the benefits of location transparency and all the types of query you get by granted from AxonFramework (point-to-point, scatter gather and subscription query).

Bear in mind that, when using "components" on the Saga, make them transient to not have them serializable.

Lucas Campos
  • 1,860
  • 11
  • 17