Broadway (Elixir)

From Elixir Wiki
Jump to navigation Jump to search

Broadway (Elixir)[edit]

File:Broadway Logo.png
Broadway Logo

Broadway is a high-level Elixir framework designed for building scalable and fault-tolerant data ingestion and processing systems. Developed by Plataformatec, Broadway simplifies the process of building robust data pipelines by providing a straightforward and flexible programming model.


Broadway offers a wide range of features that make it a powerful tool for building data processing systems. Some of its key features include:

  • **Efficient data processing**: Broadway is built on top of Elixir's lightweight concurrency model, allowing it to process large amounts of data in a performant manner.
  • **Fault tolerance**: Fault tolerance is a fundamental aspect of Broadway's design. It provides built-in mechanisms for handling failures and ensuring that data processing continues uninterrupted.
  • **Backpressure management**: Broadway includes backpressure management capabilities, which allow it to handle situations where the downstream systems cannot keep up with the influx of incoming data.
  • **Flexible message processing**: Broadway supports various message formats, such as plain Elixir data, maps, and structs. This flexibility enables developers to work with their preferred data representations.
  • **Parallel processing**: Broadway allows for parallel processing of data, distributing the workload across multiple workers and maximizing throughput.
  • **Transformation capabilities**: Broadway provides a range of transformation capabilities, allowing developers to enrich, filter, and modify data as it flows through the pipeline.

Getting Started[edit]

To start using Broadway in your Elixir project, you need to add it as a dependency in your `mix.exs` file:

```elixir defp deps do

   {:broadway, "~> 1.0"}

end ```

After adding the dependency, you can start defining your Broadway pipeline by creating a module that implements the `Broadway.Pipeline` behaviour. The pipeline module defines the stages of data processing and the transformations to be applied.

For example, a simple pipeline definition might look like this:

```elixir defmodule MyPipeline do

 use Broadway.Pipeline
 defp stage_one(data, _metadata) do
   # Stage one processing logic
 defp stage_two(data, _metadata) do
   # Stage two processing logic
 defp stage_three(data, _metadata) do
   # Stage three processing logic

end ```

Once you have defined your pipeline, you can start consuming and processing data by starting a Broadway supervision tree:

```elixir Broadway.start_link(MyPipeline, name: MyApp.Broadway) ```


Broadway offers a wealth of resources to help you get started and dive deeper into the framework:

  • [Official Broadway documentation]( - Provides detailed information on installation, configuration, and usage of Broadway.


Broadway is a powerful framework that simplifies the development of scalable and fault-tolerant data ingestion and processing systems in Elixir. With its efficient data processing, fault tolerance, and flexible message processing capabilities, Broadway provides an excellent solution for building robust data pipelines.

Whether you're dealing with real-time data ingestion, stream processing, or large-scale data transformation tasks, Broadway can help you achieve your goals in a performant and reliable manner. Start exploring Broadway today and unleash the full potential of Elixir for your data processing needs.