Skip to main content

Components

Queue payload contract

Every message on the notification topic satisfies NotificationQueuePayload:
The consumer uses channel to segment queue_event.event_type (vercel_queue.notification.<channel>) and type to pick the handler.

Dispatcher usage (producers)

Use enqueueDurable for critical notifications (payment / system / transactional) and enqueue for the rest. Bulk sends use enqueueBulk with per-batch throttling.

First real producer

The failed-payment push (PAYMENT_FAILED) is wired end-to-end: notifyPaymentFailed resolves the account members and enqueues one payment push per user when a Toku transaction.failed webhook records a failed attempt. Because payment is non-suppressible, preference gating never discards it, and any enqueue failure is logged without breaking the webhook.

Adding a new type

1

Register the type

Add it to NOTIFICATION_TYPES in notification-registry.ts.
2

Define its data

Extend notification-queue-types.ts if the type needs its own fields.
3

Optional override

Register a (channel, type) handler for type-specific logic; otherwise the default channel handler is used.
4

Produce

Call notificationDispatcher.enqueue(...) from the business service.
No change to the consumer route or vercel.json is needed for a new type within an already-supported channel.