Chimeway.Trigger (chimeway v1.0.0)

Copy Markdown View Source

Orchestrates notifier triggering with deterministic recipient normalization.

Duplicate-trigger contract (Phase 14 / D-03)

When trigger/3 returns {:duplicate, event}, dispatch_after_trigger/4 is INERT — it does NOT re-drive dispatch for the existing event. This means:

  • No new Oban jobs are enqueued.
  • No additional Chimeway.Delivery rows are planned.
  • The pre-existing pending deliveries from the first trigger remain in their current state (whether already-dispatched, retrying, or terminal).

If a host application crashes between event-insert commit and the dispatcher being called, deliveries from that aborted trigger ARE NOT recovered by a subsequent re-fire. Recovery for that scenario is explicitly deferred to a future operability phase. Operators investigating "why wasn't this delivered after a duplicate trigger?" should look at the original event's deliveries via Chimeway.Traces.get_trace/1, not at the duplicate.

Summary

Functions

normalize_recipients(recipients)

@spec normalize_recipients([map()]) :: [map()]

trigger(notifier, params, opts \\ [])

@spec trigger(module(), map(), keyword()) ::
  {:ok, map()} | {:duplicate, struct()} | {:error, term()}