Imagin I have two microservices that need to send email to a customer about some important account realted things that happened.
For example, Billing service would like to send an email when a card has expired and Users service when a password was reset.
These two services use the help of another service, let's call it email service, that is responsible to get the data and prepare an email from a predefined template with all the information necessary.
Now, let's take Card expired event as an example. It contains information that is known to Billing service like the card last 4 digits and the expiration date. But the email template also contains some more additional needed data like the user's name and possibly some other data that the neither billing service nor the email services have and is owned by another micro service.
Where do you think fetching all the information needed for the email to be sent should be handled in ? As I see there are two options:
- Billing service will prepare all the information needed for the email, including the information from billing service business domain (card expiry and last4 digits) and also anything it needs to fetch from other services
- Email service will fetch any additional information it know it needs from other services that was not contained in the event data that came from billing service in the
Card expiredevent.
In my perspective, both options are not great and I can see downsides for each:
With option #1, billing service need to know what the email template contains in order to fetch all the data it needs, which creates a coupling.
With option #2, Email service can become big if for every email type it will have to go and fetch information from other places and it's also not great.
This must be a very common pattern to handle, and I was wondering what is the right approach for it.
Thanks!

Hello ${user-svc:/customers/:id}is enough to tell it to ping some service API and place the value, when passed an id.