@bitblit/ratchet-epsilon-common
Version:
Tiny adapter to simplify building API gateway Lambda APIS
41 lines • 1.57 kB
JavaScript
import { Subject } from 'rxjs';
import { Logger } from '@bitblit/ratchet-common/logger/logger';
import { AbstractBackgroundManager } from './abstract-background-manager.js';
export class SingleThreadLocalBackgroundManager extends AbstractBackgroundManager {
_localBus = new Subject();
backgroundManagerName = 'SingleThreadLocalBackgroundManager';
immediateProcessQueue() {
return this._localBus;
}
async addEntryToQueue(entry, fireStartMessage) {
const wrapped = await this.wrapEntryForInternal(entry);
const rval = wrapped.guid;
Logger.info('Add entry to queue (local) : %j : Start : %s', entry, fireStartMessage);
this._localBus.next(wrapped);
return rval;
}
async fireImmediateProcessRequest(entry) {
let rval = null;
const wrapped = await this.wrapEntryForInternal(entry);
rval = wrapped.guid;
Logger.info('Fire immediately (local) : %j ', entry);
this._localBus.next(wrapped);
return rval;
}
async fireStartProcessingRequest() {
let rval = null;
Logger.info('Fire start processing request (local, ignored)');
rval = 'NO-OP';
return rval;
}
async fetchApproximateNumberOfQueueEntries() {
let rval = null;
rval = 0;
return rval;
}
async takeEntryFromBackgroundQueue() {
Logger.info('Called takeEntryFromBackgroundQueue on SingleThreadedLocal - returning empty');
return [];
}
}
//# sourceMappingURL=single-thread-local-background-manager.js.map