Skip to main content

Abstract Class: BackgroundService

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

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:16

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:21

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:26

Initializes the background service with any defaults.

Returns​

void | Promise<void>


stop()​

abstract stop(): void | Promise<void>

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

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

Returns​

void | Promise<void>