AshDispatch.Transport.Registry (AshDispatch v0.5.0)
View SourceCompile-time aggregator over AshDispatch.Transport implementations.
The dispatcher routes by channel.transport atom (:oban, :email,
…); this module owns the atom => module mapping and the
skip_receipt? lookup. Each known transport is listed below in
@transports; adding one is a single-line addition + a new transport
file that uses AshDispatch.Transport.
Why compile-time
At runtime, Dispatcher.dispatch_to_transport/4 is hot-path — every
event fire passes through it. A compile-time Map.new from the
module list avoids any runtime introspection cost. The Map is
module-attribute-frozen; lookups are constant time.
Why hardcoded module list (not auto-discovery)
We could walk :application.get_key(:ash_dispatch, :modules) and
filter implementers of the behaviour, but:
- Boot order matters — the dispatcher could be invoked before transport modules finish loading, producing a partial registry.
- AshDispatch is a library; its consumers can't add their own transports today (only the 8 listed here). If that changes, this module evolves to a Spark DSL-driven registry.
Today's static list is the right shape for the actual consumer set.
Summary
Functions
All registered transport modules.
All registered transport atoms.
Find the module that handles a transport atom.
Required event-metadata keys for the transport (F4). Returns []
for unknown atoms — ValidateChannels will already have raised
on the unknown transport itself.
Whether the transport skips DeliveryReceipt creation. Returns
false for unknown atoms (the safe default — produce a receipt
so the audit trail isn't silent).
Functions
@spec all() :: [module()]
All registered transport modules.
@spec atoms() :: [atom()]
All registered transport atoms.
Find the module that handles a transport atom.
Returns {:ok, module} or :error for unknown atoms. Callers
should :error-handle by logging + skipping the receipt (matches
the pre-F1 case-fallthrough behaviour).
Required event-metadata keys for the transport (F4). Returns []
for unknown atoms — ValidateChannels will already have raised
on the unknown transport itself.
Whether the transport skips DeliveryReceipt creation. Returns
false for unknown atoms (the safe default — produce a receipt
so the audit trail isn't silent).