Skip to main content

Abstract Class: BackgroundService

Defined in: service-core/src/BackgroundService.ts:10

The BackgroundService is an abstract base class for defining scheduled background services. A background service executes in the background once on startup or on a set schedule (like a cron job) and performs additional processing.

Constructors

Constructor

new BackgroundService(): BackgroundService

Returns

BackgroundService

Accessors

schedule

Get Signature

get abstract schedule(): string | undefined

Defined in: service-core/src/BackgroundService.ts:15

Returns the desired execution interval that this service should be scheduled with. If undefined is returned the service is executed only once.

Returns

string | undefined

Methods

run()

abstract run(): void | Promise<void>

Defined in: service-core/src/BackgroundService.ts:20

The processing function to execute at each scheduled interval.

Returns

void | Promise<void>


start()

abstract start(): void | Promise<void>

Defined in: service-core/src/BackgroundService.ts:25

Initializes the background service with any defaults.

Returns

void | Promise<void>


stop()

abstract stop(): void | Promise<void>

Defined in: service-core/src/BackgroundService.ts:30

Shuts down the background allowing the service to complete any outstanding tasks.

Returns

void | Promise<void>