Fallback Routing (SMS -> Email) Module
Problem
Implement an extensible message-delivery module that tries channels in priority order (SMS, then email, then push) until one succeeds. On a channel failure, retry that channel with backoff before moving on; distinguish transient failures (retry) from permanent ones (skip immediately). New channels must be pluggable without editing existing ones.
Requirements
send(msg) -> DeliveryResult: attempt channels in order, return success with the channel used, or failure if all are exhausted.- Per-channel retry with exponential backoff, capped attempts.
- Idempotency so a retry never causes a double-send.
Constraints
- Channels are pluggable; a transient failure should be retried, a permanent one should short-circuit to the next channel.
Example
send(msg): try SMS -> transient fail -> retry SMS -> permanent fail -> try email -> success
added …