BackgroundService

@thotnr-aws-accl/custom-app-api / Exports / BackgroundService

Class: BackgroundService

BackgroundService class provides methods to manage background services.

Table of contents

Methods

Methods

forceShutdownBackgroundService

Static forceShutdownBackgroundService(backgroundServiceId): Promise<unknown>

Forcefully shuts down a background service identified by its ID. This terminates the host as well on which the background service is running before marking the service as shut down.

Parameters

Name
Type
Description

backgroundServiceId

number | { backgroundServiceId: number }

The ID of the background service to shut down, either as a number or an object containing the ID.

Returns

Promise<unknown>

A promise that resolves when the service is successfully shut down or rejects with an error if the operation fails.


getAllBackgroundServicesStartable

Static getAllBackgroundServicesStartable(): Promise<BackgroundServiceModel[]>

Retrieves all startable background services.

Returns

Promise<BackgroundServiceModel[]>

A promise that resolves to an array of BackgroundServiceModel.


getAllCurrentBackgroundServices

Static getAllCurrentBackgroundServices(): Promise<BackgroundServiceModel[]>

Retrieves all current background services.

Returns

Promise<BackgroundServiceModel[]>

A promise that resolves to an array of BackgroundServiceModel.


getBackgroundServiceById

Static getBackgroundServiceById(id): Promise<BackgroundServiceModel>

Retrieves a background service by its ID.

Parameters

Name
Type
Description

id

number | { backgroundServiceId: number }

The ID of the background service to retrieve.

Returns

Promise<BackgroundServiceModel>

A promise that resolves to a BackgroundServiceModel.


getBackgroundServiceHostStatusById

Static getBackgroundServiceHostStatusById(backgroundServiceParams): Promise<BackgroundServiceHost>

Retrieves the status of a background service host by the background service ID.

Parameters

Name
Type
Description

backgroundServiceParams

BackgroundServiceParams

The parameters of the background service.

Returns

Promise<BackgroundServiceHost>

A promise that resolves to the status of the background service host.


getBackgroundServiceUpdatedStatusById

Static getBackgroundServiceUpdatedStatusById(backgroundServiceParams): Promise<void>

Updates the status of a background service by its ID and label, then executes callbacks based on the result.

Parameters

Name
Type
Description

backgroundServiceParams

BackgroundServiceParams

The parameters of the background service.

Returns

Promise<void>

A promise that resolves to void.


getBackgroundServicesByLabel

Static getBackgroundServicesByLabel(label): Promise<BackgroundServiceModel[]>

Retrieves background services by their label.

Parameters

Name
Type
Description

label

string

The label of the background services to retrieve.

Returns

Promise<BackgroundServiceModel[]>

A promise that resolves to an array of BackgroundServiceModel.


shutdownBackgroundService

Static shutdownBackgroundService(backgroundServiceParams): Promise<void>

Shuts down a background service by its ID and label, then executes callbacks based on the result.

Parameters

Name
Type
Description

backgroundServiceParams

BackgroundServiceParams

The parameters of the background service.

Returns

Promise<void>

A promise that resolves to void.


startNewBackgroundServiceOrReturnExisting

Static startNewBackgroundServiceOrReturnExisting(label): Promise<SparkWebLauncherHost>

Starts a new background service or returns an existing one based on the provided label.

Parameters

Name
Type
Description

label

string | { label: string }

The label of the background service.

Returns

Promise<SparkWebLauncherHost>

A promise that resolves to a SparkWebLauncherHost object.

Last updated