The producer/consumer pattern
This decoupling of the
find command from the
egrep command is intentional. Consumer not knowing about producers and vice versa has the following advantages:
- If we use a real message broker, such as the RabbitMQ server, we can even have producers and consumers written in different programming languages. For example, we can have a producer in Java and a consumer in Python. For the Unix example too, we can write filters in different languages and connect them together.
- We can have any number of producers and consumers.
- If some producers or consumers fail, the system keeps operating, although less effectively.
The last point is what makes us integrate different existing systems together. This is a very powerful concept.