Mailglass.Lifecycle behaviour (Mailglass v2.4.1)

Copy Markdown View Source

Compatibility lifecycle seam for adopter-side event composition.

The callback shape remains handle_event(Ecto.Multi.t(), map()) :: Ecto.Multi.t(). For one-click unsubscribe, Mailglass calls handle_event(Ecto.Multi.new(), attrs) only after the primary event and suppression convergence commits, then runs the returned Multi as a separate, best-effort transaction. A lifecycle failure is logged and cannot roll back or change the already-successful unsubscribe response.

Summary

Functions

Default no-op implementation for lifecycle hooks.

Callbacks

handle_event(t, map)

@callback handle_event(Ecto.Multi.t(), map()) :: Ecto.Multi.t()

Functions

handle_event(multi, attrs)

@spec handle_event(Ecto.Multi.t(), map()) :: Ecto.Multi.t()

Default no-op implementation for lifecycle hooks.

Returns the supplied Multi unchanged so adopters can opt out without branching in the caller.