Cqrs + microservices architecture : how to get data from another service

Viewed 1451

I'm playing around with setting up a microservices / cqrs architecture for a personal project, and there's one point I don't understand in the "standard" setup.

By standard setup, I mean

https://www.ibm.com/developerworks/cloud/library/cl-build-app-using-microservices-and-cqrs-trs/index.html

Say I have an orders service and a pickup points service, and I have a command like "send order summary email".

How should the orders service get the data about the pickup point (eg opening hours etc) that it needs to send the email ? I see 4 possibilities, but there are surely others.

  1. The command goes directly to the orders service, and then the orders service queries the pickup points service to get the data.

  2. The command goes to the pickup points service, and then pickup points service publishes a new event for orders service with the needed information attached.

  3. The command goes directly to the orders service, and the orders service then queries the read-only client-facing database.

  4. Merge the 2 services... given that they have no other shared context, this would be a pity...

Thanks !

2 Answers
Related