Cyclium. Gatherer behaviour
(Cyclium v0.1.5)
Copy Markdown
Behaviour for data-gathering modules used by strategy templates.
Gatherers are the bridge between DB-defined dynamic actors and your application's data layer. The compiled app implements gatherers and registers them by name so dynamic actors can reference them without needing Elixir code.
Usage
defmodule MyApp.Gatherers.ProjectData do
@behaviour Cyclium.Gatherer
@impl true
def gather(trigger_payload, _opts) do
project_id = trigger_payload["project_id"]
project = Repo.get!(Project, project_id)
orders = load_orders(project_id)
{:ok, %{project: project, orders: orders}}
end
endRegister in your app config:
config :cyclium, :gatherer_registry, %{
"project_data" => MyApp.Gatherers.ProjectData,
"client_metrics" => MyApp.Gatherers.ClientMetrics
}
Summary
Functions
Resolves a gatherer module by its registered name.
Returns nil if no gatherer is registered with the given name.