In our small e-commerce example, we are still missing the shipping service. In real-world scenarios, this would be a really complex task, and you would often need to communicate with outside parties and maybe integrate with APIs of external transport service providers. For this reason, we will now build our shipping service as a worker pool using PUSH and PULL sockets and an arbitrary number of worker processes.
A PUB socket publishes each message to all connected subscribers. ZeroMQ also offers the PUSH and PULL socket types - they work similar to PUB/SUB, but each message published on a PUSH socket is sent to only one of potentially many connected PULL sockets. You can use this to implement a worker pool into which you can push long-running tasks that are then executed in parallel.
For this, we will need one master process that uses a SUB socket to subscribe to completed checkout orders. The same process needs to offer a PUSH socket that...