Summary

In this chapter we learned how Elixir elegantly tackles the problem of processing events in stages by analyzing the GenStage and Flow abstractions:

  • We implemented our media upload and download pipelines with GenStage, putting to good use its elegant back-pressure mechanism. To achieve this, we had to implement the needed callbacks on the different modules behind the pipeline stages and start each pipeline supervisor on the application initialization.
  • We then examined Flow, an abstraction based on GenStage that lets you process collections in a lazy and concurrent fashion, while keeping much of the semantics one associates with the Enum and Stream modules.

The advantage of using GenStage is that no step in the media pipeline will ...

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.