In the next step, we will put a mailing service into our Microservice architecture. After a checkout was processed, the user should be notified via e-mail about the status of the checkout.
Tip
As mentioned before, the focus of this chapter is on building the communication patterns between individual services. Because of this, we will not implement the mailing service's actual mailing functionality in this section, but instead focus on how this service will communicate with other services. Have a look at Chapter 3, Building a Social Newsletter Service, to see how you can use PHP to actually send e-mails to other recipients.
In theory, you could implement the mailing service just as you did the inventory service - build a standalone PHP program that listens on a ZeroMQ REP socket, have the checkout service open an REQ socket, and send requests to the mailing service. However, the same can also be achieved using the publish/subscribe pattern.
Using the publish/subscribe...