Cyclium.Strategy.Template.Dispatch (Cyclium v0.1.12)

Copy Markdown View Source

Data-driven strategy template: Gather entities → Broadcast events.

Fan-out pattern. Calls a gatherer that returns a list of entities, then broadcasts a bus event for each entity to trigger downstream actors. All gathering and broadcasting happens in init — no step loop needed.

Strategy config shape

%{
  "gatherer" => "active_projects",
  "event_type" => "project_health.check_requested",
  "entity_id_field" => "id",
  "entity_payload_fields" => ["id", "name"]
}

The gatherer must return {:ok, %{entities: [%{...}, ...]}} where each entity is a map. The entity_id_field and entity_payload_fields control what gets broadcast.