galena v0.1.2 Galena.Producer behaviour

Galena.Producer is a customized GenStage producer which uses GenStage.BroadcastDispatcher as dispatcher.

Definition

defmodule MyProducer do
  use Galena.Producer

  def handle_produce({topic, message}) do
    {topic, message}
  end
end

Start Up

{:ok, producer} = MyProducer.start_link([], [name: :producer])

Data Ingestion

MyProducer.ingest(:producer, data)

Summary

Functions

This function is the responsible of the data ingestion by the chosen producer. The data can be whatever

Callbacks

It will be executed just before a message is sent to the consumers (or producer-consumers)

Types

data()
data() :: any
message()
message() :: any
topic()
topic() :: any

Functions

ingest(producer, data)

This function is the responsible of the data ingestion by the chosen producer. The data can be whatever.

Callbacks

handle_produce(data)
handle_produce(data) :: {topic, message}

It will be executed just before a message is sent to the consumers (or producer-consumers).

The input of the function can be whatever type. The output of that function has to be a tuple where the first parameter will be the topic and the second one the message.