How it works
A channel worker pulls eligible attempts from its queue and calls a provider adapter, a thin module that translates one internal request into one provider’s API. Push uses a device token and a platform push service such as Apple’s APNs or Google’s FCM; email uses an email provider; SMS uses an SMS gateway. Adapters isolate request formats, credentials, rate rules, and response codes so a replacement provider does not change event ingestion. With one provider and no plan to switch, a plain wrapper is enough.
The worker records a provider request ID and outcome. A provider acknowledgement means it accepted the request, not that the recipient saw it. Device-token invalidation, email bounces, SMS delivery receipts, and open events are separate later signals with varying reliability. Amazon SES, for example, can report bounces through SNS, which may deliver a notification more than once. Treat provider callbacks as untrusted input: authenticate them and deduplicate repeated status events, so a second copy of one bounce changes nothing.
A fallback channel is a product decision. An email outage should not automatically turn every promotional email into an expensive SMS or bypass consent: at an example price of $0.01 per message, one million diverted emails cost $10,000. If a critical alert permits fallback, define a delay, allowed channels, and a shared notification ID so two successes do not surprise the user. A fraud alert might try push, wait five minutes for the app to confirm receipt, then text a consenting user.
The push provider accepts an alert, but the user’s device is offline. Should the system mark it as read or immediately send SMS?
Neither. Mark provider acceptance, wait for any later device or app signal, and follow the alert’s explicit fallback policy if one exists. Offline push can be delayed; SMS needs its own consent and cost rule.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Channel adapters contain provider-specific behavior while queues isolate outages.
- Provider acceptance, downstream delivery, and user engagement are different observations.