Reputation: 133
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 🙏
Upvotes: 1
Views: 392
Reputation: 1920
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.
Upvotes: 3