Parapet.Notifier behaviour (parapet v1.0.0)

Copy Markdown View Source

Behaviour for incident notification adapters.

Stable

This module is stable as of v1.0.0. Its public API will not change without a major-version bump and a full deprecation cycle. See Stability & Deprecation Policy for details.

Summary

Callbacks

Delivers a notification for the given incident to one adapter. Implemented by concrete notification adapters (e.g., Slack, Teams).

Functions

Dispatches a notification for the given incident to all configured notifiers. Uses Oban for async delivery when available; falls back to Task.start/1.

Dispatches a single notification to the given adapter with the provided opts. Enqueues via Oban when available; otherwise executes in a supervised Task.

Callbacks

deliver(incident, opts)

(since 1.0.0)
@callback deliver(incident :: struct(), opts :: keyword()) ::
  {:ok, term()} | {:error, term()}

Delivers a notification for the given incident to one adapter. Implemented by concrete notification adapters (e.g., Slack, Teams).

Functions

broadcast(incident)

(since 1.0.0)

Dispatches a notification for the given incident to all configured notifiers. Uses Oban for async delivery when available; falls back to Task.start/1.

dispatch(incident, adapter, opts)

(since 1.0.0)

Dispatches a single notification to the given adapter with the provided opts. Enqueues via Oban when available; otherwise executes in a supervised Task.