Oban worker that dispatches a queued Delivery (SEND-03). Conditionally
compiled — entire module elided when :oban is not loaded.
Args schema (api_stability.md §Outbound.Worker)
%{
"delivery_id" => binary(), # UUIDv7 string
"mailglass_tenant_id" => binary() # matches Mailglass.Oban.TenancyMiddleware contract
}Never serialize %Message{} into args — adopter types may not
be JSON-safe (functions, PIDs, structs with private fields).
Options locked (api_stability.md §Outbound.Worker)
queue: :mailglass_outboundmax_attempts: 20— transactional SLAs are tight; exponential backoff reaches ~hours by attempt 20unique: [period: 3600, fields: [:args], keys: [:delivery_id]]— prevents double-enqueue on retry storms
perform/1 flow
TenancyMiddleware.wrap_perform/2restoresMailglass.Tenancy.current/0from argsMailglass.Outbound.dispatch_by_id/1hydrates the Delivery by id, calls the adapter OUTSIDE the job's transaction, writes Multi#2