ProducerConsumer and Consumer stages

We now want to create an equivalent get_worker_specs/1 function that also receives the subscription options that each worker should use. To illustrate this case, let's use the second stage of the previous Qaz pipeline:

iex> producer_consumer_step = Qaz.show_pipeline_steps |> Enum.at(1)[  producer_consumer: Step1Module,  args: [],  options: [max_demand: 6, min_demand: 4, count: 3]]

We will spawn three Step1Module processes (given by the count option), and these processes will all subscribe to every process of the previous stage. The previous stage will have two processes (we already analyzed their worker specs); therefore, each of the three Step1Module processes will subscribe to the producer processes whose ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.