Interface Sequence<Type, Data, CustomHeaders, CustomOptions>

Sequence Source interface definition A Sequence is a Source that allows to manage the flow of Jobs using the ingestData method to control the rate of Jobs that can be processed

interface Sequence<
    Type extends string = string,
    Data = any,
    CustomHeaders extends Record<string, any> = AnyHeaders,
    CustomOptions extends Record<string, any> = AnyOptions,
> {
    metrics?: Registry<"text/plain; version=0.0.4; charset=utf-8">;
    postConsume: (jobId: string) => Promise<undefined | string>;
    ingestData(
        size: number,
    ): Promise<
        | JobRequest<Type, Data, CustomHeaders, CustomOptions>
        | JobRequest<Type, Data, CustomHeaders, CustomOptions>[],
    >;
    on(event: "error", listener: (error: Crash | Error) => void): this;
    on(
        event: "status",
        listener: (status: "pass" | "fail" | "warn") => void,
    ): this;
    on(
        event: "data",
        listener: (
            job: JobRequest<Type, Data, CustomHeaders, CustomOptions>,
        ) => void,
    ): this;
    start(): Promise<void>;
    stop(): Promise<void>;
}

Type Parameters

  • Type extends string = string
  • Data = any
  • CustomHeaders extends Record<string, any> = AnyHeaders
  • CustomOptions extends Record<string, any> = AnyOptions

Hierarchy (View Summary)

Properties

metrics?: Registry<"text/plain; version=0.0.4; charset=utf-8">

Metrics registry for this component

postConsume: (jobId: string) => Promise<undefined | string>

Perform the task to clean the job registers after the job has been resolved

Type declaration

    • (jobId: string): Promise<undefined | string>
    • Parameters

      • jobId: string

        Job entry identification

      Returns Promise<undefined | string>

      • the job entry identification that has been correctly removed or undefined if the job was not found

Methods

  • Emitted when the component throw an error

    Parameters

    • event: "error"
    • listener: (error: Crash | Error) => void

    Returns this

  • Emitted on every status change

    Parameters

    • event: "status"
    • listener: (status: "pass" | "fail" | "warn") => void

    Returns this

  • Emitted when there is a new job to be managed

    Parameters

    Returns this

  • Start the Plug and the underlayer resources, making it available

    Returns Promise<void>

  • Stop the Plug and the underlayer resources, making it unavailable

    Returns Promise<void>