Class: Job
A message added to a queue: its id, and its result once processed (Job.result).
Example
typescript
import type {Job, Queue} from '@lakutata/queue'
declare const queue: Queue
const job: Job = await queue.add('image.extract', {id: 7})
console.log(job.id, await job.result({timeout: '1m'}))Constructors
Constructor
new Job(
queue,name,id):Job
Parameters
queue
The queue component.
name
string
The queue of the message.
id
string
The id of the message.
Returns
Job
Properties
id
readonlyid:string
name
readonlyname:string
Methods
result()
result<
Result>(options?):Promise<Result>
The result of the message: the value returned by its action.
Type Parameters
Result
Result = unknown
Parameters
options?
How long to wait, and the group read.
Returns
Promise<Result>
The value returned.
Throws
When the message failed.
Throws
When it is not processed in time (or wait is false).
Throws
When its result is no longer kept.