Skip to content

A simple durable task pattern made with BullMQ primitives

Notifications You must be signed in to change notification settings

waerhert/durabletask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DurableTask

A function, but every execution is archived, queryable, and can be retried on failure. Based on BullMQ primitives: Queue, Worker, QueueEvents.

import { DurableTask } from './src/durable-task.js';

const task = new DurableTask('send-email', async (input, logger) => {
  logger.info(`Processing ${input.to}`);
  return { sent: true };
});

task.startWorker();

await task.callSync({ to: 'user@example.com' });

await task.getHistory();

await sendEmail.retryAllFailed();

About

A simple durable task pattern made with BullMQ primitives

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published