Classes
@system-inc/base-foundation · 515c140 · 4 symbols
Base class for messages that are persisted before being queued. Orm (Drizzle) counterpart of PersistedMessageEntity: the row tracks the message's processing status across the queue lifecycle. Extend it with the message's specific data.
extends OrmMutableBaseEntity
Members
createdAt:Dateid:stringstatus:PersistentMessageStatusstatusChangedAt:Date | nullThe time at which the status was last changed.
statusMeta:object | nullMetadata specifically related to the current status of the job.
updatedAt:DatehasBeenUpdated:booleanWhether this row has been updated since it was created.
updatedAtis initialized to the same instant ascreatedAton insert, then bumped on every update — so the row has never been updated exactly whenupdatedAt === createdAt. (This replaces the old "updatedAt is null" sentinel, which couldn't work on backends where the column is NOT NULL.)clone():TgetChangedFields():OrmPartialEntity<this>toJSON(options?:{ strict?: boolean }):Dictionary<unknown>updateStatus(status:PersistentMessageStatus,statusMeta?:object):voidUpdate the status of the job.
static from(this:() => T,data:OrmPartialEntity<T>):TCreate a new instance of the entity with the given data.
WorkerQueue
A WorkerQueue is a queue that can be used to submit messages processing by a different consuming worker. This allows you to offload work to a different worker to be processed after the current worker has finished handling the request.
Members
queue:stringsubmit(message:WorkerQueueMessage<MessageType> | (WorkerQueueMessage<MessageType>)[],options?:WorkerQueueMessageOptions):void
WorkerQueueBinding
Binding for a Cloudflare Queue producer. The name matches the
binding declared in wrangler.toml. Used with
@InjectWorkerQueue(...).
The MessageType parameter is the type of message the queue
accepts; the decorator return type threads it through as
WorkerQueue<MessageType>.
extends TypedBinding
Members
name:stringtoString():string
Provides context about the queue message being processed.
Members
container:BaseInjectionContainerattempts:numberThe number of times the message has been attempted to be processed.
id:stringThe unique identifier for the message on the queue.
timestamp:DateThe timestamp when the message was received by the queue.
type:stringThe type of the message.
acknowledge():voidAcknowledge the message, indicating that it has been processed successfully.
getMessage():MessageTypeGet the payload of the message as a specific type.
retry(options?:any):voidRetry the message, indicating that it should be reprocessed.