Skip to content

Service

feathersTasks (options)

Configures and registers the tasks service on a Feathers application. Called via app.configure().

ParameterDescriptionRequired
persistenceServiceName of the Feathers service used to persist task records.yes
redisRedis connection options passed directly to BullMQ ({ host, port, password, ... }).yes
queue.nameBullMQ queue name. Default: 'tasks'.no
queue.concurrencyNumber of jobs processed in parallel by the worker. Default: 1.no
handlersObject mapping job type names to async handler functions (job) => any.no
dashboard.enabledMount the Bull Board UI. Default: false.no
dashboard.basePathBase path for the Bull Board Express router. Default: '/admin/tasks'.no

Registers app.service('tasks') as a TaskService instance.

TaskService

create (data, params)

Submits a new task to the BullMQ queue and creates a record in the persistence service.

PropertyTypeRequiredDescription
data.typestringyesJob type — matched against a key in handlers.
data.payloadobjectnoArbitrary data forwarded to the handler as job.data.
data.optionsobjectnoBullMQ JobsOptions (delay, attempts, priority, etc.).

Returns the persisted task record:

FieldDescription
idBullMQ job id.
typeJob type.
payloadData passed to the handler.
status'waiting' at creation time.
createdAtISO timestamp.

find (params)

Delegates to the persistence service. Accepts the same params.query as the underlying adapter.

Returns a list (or paginated result) of task records.

get (id, params)

Retrieves a single task record from the persistence service by BullMQ job id.

ParameterDescription
idBullMQ job id (string).

Throws NotFound if no record matches.

patch (id, data, params)

Updates fields on a task record in the persistence service. Primarily used internally by the QueueEvents listener to reflect status changes.

ParameterDescription
idBullMQ job id.
dataFields to merge into the record (e.g. { status, completedAt, result }).

remove (id, params)

Cancels the BullMQ job (if still pending) and removes the record from the persistence service.

ParameterDescription
idBullMQ job id.

Throws NotFound if no persistence record matches. Does not throw if the job is no longer in the queue (already completed/failed).