AshDispatch.Notifier.DispatchHandler (AshDispatch v0.5.1)

View Source

Side-effect orchestration for dispatch events — extracted from the prior AshDispatch.Changes.DispatchEvent module.

Why this exists separately from the notifier

AshDispatch.Notifier is a thin adapter that pattern-matches the notification's action and looks up per-action config. The actual dispatch logic — event-module resolution, context building, channel resolution, dispatcher invocation — lives here. This isolates the "what to dispatch" decisions (Notifier) from the "how to dispatch" orchestration (DispatchHandler).

Two modes (preserved verbatim from the prior change module)

  • DSL-based — driven by an event :foo, ... end block that the transformer persisted as a config map with :event_config.
  • Standalone — for events that bypass the DSL block and were historically registered via change DispatchEvent, event_id, data_key. Mosis has zero such callers today; the path is preserved for AshDispatch substrate completeness.

Summary

Functions

Dispatch a single event for a notification.

Functions

dispatch(notification, config)

@spec dispatch(Ash.Notifier.Notification.t(), map()) :: :ok

Dispatch a single event for a notification.

Takes the notification (an %Ash.Notifier.Notification{}) and the per-action event_config persisted by InjectDispatchChanges. Equivalent to the prior dispatch_event/4 private function called from the change's after_action hook.