Slide 23
Slide 23 text
Example 5 - GenStage (custom demand)
{:ok, select} = GenStage.start_link(Select, :ok)
{:ok, download} = GenStage.start_link(Download, :ok)
{:ok, extract} = GenStage.start_link(Extract, :ok)
{:ok, index} = GenStage.start_link(Index, :ok)
GenStage.sync_subscribe(download, to: select, max_demand: 20)
GenStage.sync_subscribe(extract, to: download, max_demand: 20)
GenStage.sync_subscribe(index, to: extract, max_demand: 100)
:timer.sleep(:infinity)