Skip to main content
zerotal

Documentation


Documentation / @zerotal/notifications / SendNotificationJob

Class: SendNotificationJob

Defined in: notifications/src/SendNotificationJob.ts:22

Background job that sends a queued Notification. Dispatched by Notify.queue() and notifyLater().

The job carries the notification in one of two states. Dispatched in-process it holds the live objects and uses them directly. Restored from a persistent driver (SQLite/Redis) it holds only the serialized snapshot written by payload(), and rebuilds both sides in handle() — asynchronously, because resolving a notification class may require importing app/notifications/.

Extends

Constructors

Constructor

new SendNotificationJob(_notifiable?, _notification?, serialized?): SendNotificationJob

Defined in: notifications/src/SendNotificationJob.ts:27

Parameters

_notifiable?

Notifiable

_notification?

Notification

serialized?

SerializedNotification

Returns

SendNotificationJob

Overrides

Job.constructor

Properties

queue

readonly queue: "notifications" = "notifications"

Defined in: notifications/src/SendNotificationJob.ts:23

Queue name — override in subclass to route to specific queues

Overrides

Job.queue


maxAttempts

readonly maxAttempts: number = 3

Defined in: queue/src/Job.ts:8

Max retry attempts before moving to failed queue

Inherited from

Job.maxAttempts


retryDelay

readonly retryDelay: number = 1000

Defined in: queue/src/Job.ts:11

Milliseconds to wait between retry attempts

Inherited from

Job.retryDelay


batchId

batchId: string | undefined = undefined

Defined in: queue/src/Job.ts:14

Set by Bus.batch() — tracks which batch this job belongs to.

Inherited from

Job.batchId


_chain

_chain: SerializedJob[] | undefined = undefined

Defined in: queue/src/Job.ts:17

Set by Bus.chain() — remaining jobs to dispatch after this one succeeds.

Inherited from

Job._chain

Accessors

className

Get Signature

get className(): string

Defined in: queue/src/Job.ts:34

The class name used as the serialization key. Must match what JobRegistry.register() stores.

Returns

string

Inherited from

Job.className

Methods

payload()

payload(): Record<string, unknown>

Defined in: notifications/src/SendNotificationJob.ts:37

The wire form stored by persistent queue drivers.

Returns

Record<string, unknown>

Overrides

Job.payload


fromPayload()

static fromPayload(data): SendNotificationJob

Defined in: notifications/src/SendNotificationJob.ts:45

Rebuild the job from a stored payload. Called by the queue on the worker side.

Parameters

data

Record<string, unknown>

Returns

SendNotificationJob


handle()

handle(): Promise<void>

Defined in: notifications/src/SendNotificationJob.ts:49

The job's work — implement this in every subclass

Returns

Promise<void>

Overrides

Job.handle