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
Functions
Callbacks
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.