Producer and consumer actors with back-pressure for Elixir http://hexdocs.pm/gen_stage
Find a file
2026-01-09 08:44:33 +01:00
.github/workflows Update CI (#314) 2025-06-22 10:35:26 -07:00
examples Add references for license (#286) 2022-05-26 08:47:12 +02:00
lib update documentation (#322) 2025-12-22 09:46:40 +01:00
test Do not duplicate demand in BroadcastDispatcher (#319) 2025-07-15 21:06:09 +02:00
.formatter.exs Format the codebase and check for formatted files on CI (#197) 2018-02-23 11:32:10 +01:00
.gitignore Fix FIFO ordering for queued sync_info messages (#316) 2025-06-30 10:37:25 +02:00
CHANGELOG.md Release v1.3.2 2025-07-15 21:19:21 +02:00
mix.exs Make the README the default docs page (#323) 2026-01-09 08:44:33 +01:00
mix.lock Release v1.3.0 2025-06-24 12:33:23 +02:00
README.md Add references for license (#286) 2022-05-26 08:47:12 +02:00

GenStage

GenStage is a specification for exchanging events between producers and consumers.

This project currently provides the following functionality:

  • GenStage (docs) - a behaviour for implementing producer and consumer stages

  • ConsumerSupervisor (docs) - a supervisor designed for consuming events from GenStage and starting a child process per event

You may also be interested in two other projects built on top of GenStage:

Examples

Examples for using GenStage and ConsumerSupervisor can be found in the examples directory:

  • ProducerConsumer - a simple example of setting up a pipeline of A -> B -> C stages and having events flowing through it

  • ConsumerSupervisor - an example of how to use one or more ConsumerSupervisor as a consumer to a producer that works as a counter

  • GenEvent - an example of how to use GenStage to implement an alternative to GenEvent that leverages concurrency and provides more flexibility regarding buffer size and back-pressure

  • RateLimiter - an example of performing rate limiting in a GenStage pipeline

Installation

GenStage requires Elixir v1.5. Just add :gen_stage to your list of dependencies in mix.exs:

def deps do
  [{:gen_stage, "~> 1.0"}]
end

License

Same as Elixir under Apache License 2.0. Check NOTICE and LICENSE for more information.