O'Reilly logo

Scala Functional Programming Patterns by Atul S. Khot

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required