durabull
Version:
A durable workflow engine built on top of BullMQ and Redis
33 lines (32 loc) • 920 B
TypeScript
/// <reference types="node" />
export interface ActivityConfig {
queue?: string;
connection?: {
redisUrl?: string;
};
}
export interface ActivityContext {
workflowId: string;
activityId: string;
attempt: number;
heartbeat: () => void | Promise<void>;
signal?: AbortSignal;
}
export declare abstract class Activity<TArgs extends unknown[] = unknown[], TResult = unknown> {
tries?: number;
timeout?: number;
queue?: string;
connection?: {
redisUrl?: string;
};
private context?;
private lastHeartbeat;
abstract execute(...args: TArgs): Promise<TResult>;
backoff(): number[];
protected heartbeat(): void;
protected workflowId(): string;
protected get signal(): AbortSignal | undefined;
_setContext(context: ActivityContext): void;
_getLastHeartbeat(): number;
_executeWithRetry(...args: TArgs): Promise<TResult>;
}