Skip to main content

PolledExternalService

An external HTTP service that is kept up-to-date by polling.

A PolledExternalService may be composed of one or more PolledHTTPResources, each of which describes a single endpoint and how to poll it.

Implements

  • ExternalService

Constructors

new PolledExternalService()

new PolledExternalService(resources): PolledExternalService

Construct a polled external service.

Parameters

ParameterTypeDescription
resources{}Specification(s) of external resource(s) to poll

Returns

PolledExternalService

Methods

shutdown()

shutdown(): Promise<void>

Shutdown the external service.

Returns

Promise<void>

Implementation of

ExternalService.shutdown

subscribe()

subscribe(
instance,
resourceName,
params,
callbacks): Promise<void>

Subscribe to a resource provided by the external service.

Parameters

ParameterTypeDescription
instancestringInstance identifier of the external resource.
resourceNamestring-
paramsJsonParameters of the external resource.
callbacks{ error: (error) => void; update: (updates, isInit) => Promise<void>; }Callbacks to react on error/update.
callbacks.error(error) => voidError callback to log the error that prevent an idermetiate update.
callbacks.update(updates, isInit) => Promise<void>Update callback.

Returns

Promise<void>

Implementation of

ExternalService.subscribe

unsubscribe()

unsubscribe(instance): void

Unsubscribe from a resource provided by the external service.

Parameters

ParameterTypeDescription
instancestringInstance identifier of the external resource.

Returns

void

Implementation of

ExternalService.unsubscribe