0.0.1 • Published 4 months ago

@forts/resilience4ts-concurrent-queue v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

@forts/resilience4ts-concurrent-queue

Concurrent queue pattern implementation for resilience4ts.

Installation

npm install @forts/resilience4ts-concurrent-queue

Usage

import { ConcurrentQueue } from '@forts/resilience4ts-concurrent-queue';

const queue = ConcurrentQueue.of('my-queue', {
  withKey: (...args: Parameters<MyDecoratedMethod>) => UniqueId,
});

const result = await queue.on(async () => {
  // do something
});

Options

const queue = ConcurrentQueue.of('my-queue', {
  withKey: (...args: Parameters<MyDecoratedMethod>) => UniqueId, // Function that returns a unique id for the call from the decorated function args.
  maxAttempts?: number; // Maximum number of attempts to execute the decorated method.
  backoff?: number; // Backoff in milliseconds between attempts.
});
0.0.1

4 months ago

0.0.0

4 months ago