JobQueueWorker.onPop() method
Registers the handler called for each job popped from this queue.
Signature:
onPop(handler: JobQueuePopHandler<T>): JobQueueWorker<T>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
handler |
what to do with each job; its return value re-schedules |
Returns:
this queue, for chaining
Remarks
Replaces any handler already registered rather than adding to it — there is one handler per worker, and the last call wins. Nothing is delivered until BaseJobQueue.start() has been called, so registering the handler first and starting second is the order that cannot drop a job.
A message that is not an object — null, undefined or a bare primitive, none of which this package produces — is logged as invalid and dropped without reaching the handler, so the handler can assume it is being given a job rather than having to guard for one.
See JobQueuePopHandler for what the handler's return value does, which is where this queue's retry behaviour is decided.
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.