Observables
import { WorkerPro } from "@taskforcesh/bullmq-pro"
import { Observable } from "rxjs"
const processor = async () => {
return new Observable<number>(subscriber => {
subscriber.next(1);
subscriber.next(2);
subscriber.next(3);
const intervalId = setTimeout(() => {
subscriber.next(4);
subscriber.complete();
}, 500);
// Provide a way of canceling and disposing the interval resource
return function unsubscribe() {
clearInterval(intervalId);
};
});
};
const worker = new WorkerPro(queueName, processor, { connection });Last updated
Was this helpful?