Reputation: 41
I'm currently conflicted on how to implement a solution in our microservices architecture. And, it would be nice to have a more expert opinion on the matter.
We are using a third party service to send emails, however before we can made use of the mentioned service we need to synchronize an account.
Right now I'm using the provided SDK of the third party service in two microservices. In the account-ms I create all the necessary functionalities for the synchronization of an account. And in the email-ms I did the corresponding for the sending of emails.
However, I'm not sure if using (the Third party SDK) in two different microservice is the correct thing to do or if I am falling into a bad practice, and I should have both processes (account syncing and email sending) in the same microservice that will be the only one using the third party SDK.
Thanks.
NOTE: both account-ms and email-ms already existed and have another relevant functionalities for their domain on them. I didn't crate them from scratch for this particular integration.
Upvotes: 2
Views: 283
Reputation: 9555
The answer is simply: yes - That is very common.
However, there is a very big difference between just using the same libraries (sdk) in multiple services and having a functional dependency between two services.
You always want to be very aware of service dependencies and avoid them where possible. It is not a hundred percent clear what you mean by that your "account service needs to synchronize an account", but if that means your email service has to call the account service (or depends on a persistent state that is created by the account service) every time before it can fetch emails than you introduced a hard dependency between the services and you need to establish all the communication channels about version compatibility, release schedule, upgrades, etc. between the two Microservice teams. In this case (if it was feasible) it may be better if every service using email would be able to initialize without the use of other services.
Upvotes: 1