@bitblit/epsilon
Version:
Tiny adapter to simplify building API gateway Lambda APIS
26 lines (25 loc) • 1.6 kB
TypeScript
import { BackgroundEntry } from '../background-entry';
import { InternalBackgroundEntry } from '../internal-background-entry';
import { Subject } from 'rxjs';
/**
* Classes implementing this interface handle all submission of work to the background processing system.
*
* Note that these do NOT validate the input, they just passes it along. This is
* because it creates a circular reference to the processors if we try since they
* define the type and validation.
*/
export interface BackgroundManagerLike {
get backgroundManagerName(): string;
immediateProcessQueue?(): Subject<InternalBackgroundEntry<any>>;
createEntry<T>(type: string, data?: T): BackgroundEntry<T>;
wrapEntryForInternal<T>(entry: BackgroundEntry<T>, overrideTraceId?: string, overrideTraceDepth?: number): Promise<InternalBackgroundEntry<T>>;
addEntryToQueueByParts<T>(type: string, data?: T, fireStartMessage?: boolean): Promise<string>;
addEntryToQueue<T>(entry: BackgroundEntry<T>, fireStartMessage?: boolean): Promise<string>;
addEntriesToQueue(entries: BackgroundEntry<any>[], fireStartMessage?: boolean): Promise<string[]>;
fireImmediateProcessRequestByParts<T>(type: string, data?: T): Promise<string>;
fireImmediateProcessRequest<T>(entry: BackgroundEntry<T>): Promise<string>;
fireStartProcessingRequest(): Promise<string>;
fetchApproximateNumberOfQueueEntries(): Promise<number>;
takeEntryFromBackgroundQueue(): Promise<InternalBackgroundEntry<any>[]>;
modifyPayloadPreProcess?<T>(entry: InternalBackgroundEntry<T>): Promise<InternalBackgroundEntry<T>>;
}