Skip to content

PURISTA API


PURISTA API / @purista/core / ServiceClass

Interface: ServiceClass<S>

Defined in: core/types/ServiceClass.ts:18

The ServiceClass interface

Type Parameters

S

S extends ServiceClassTypes<any, any, any> = ServiceClassTypes<any, any, any>

Properties

__serviceClassTypes?

readonly optional __serviceClassTypes?: S

Defined in: core/types/ServiceClass.ts:24

Type-only anchor used to preserve cascading service builder types.

This property is never read at runtime.


config

config: S["ConfigType"]

Defined in: core/types/ServiceClass.ts:26


resources

resources: S["Resources"]

Defined in: core/types/ServiceClass.ts:27

Methods

destroy()

destroy(): Promise<void>

Defined in: core/types/ServiceClass.ts:32

Stop and destroy the current service

Returns

Promise<void>


getContextFunctions()

getContextFunctions(logger): ContextBase<S["Metrics"]>

Defined in: core/types/ServiceClass.ts:90

Parameters

logger

Logger

Returns

ContextBase<S["Metrics"]>


getInFlightDiagnostics()

getInFlightDiagnostics(): InFlightDiagnostics

Defined in: core/types/ServiceClass.ts:92

Returns

InFlightDiagnostics


getPausedSubscriptionConsumerState()

getPausedSubscriptionConsumerState(): PausedSubscriptionConsumersByRegistrationKey

Defined in: core/types/ServiceClass.ts:96

Returns

PausedSubscriptionConsumersByRegistrationKey


getQueueWorkerPauseState()

getQueueWorkerPauseState(): QueueWorkerPauseStateByQueue

Defined in: core/types/ServiceClass.ts:93

Returns

QueueWorkerPauseStateByQueue


getServiceHealth()

getServiceHealth(): Promise<ServiceHealthState>

Defined in: core/types/ServiceClass.ts:91

Returns

Promise<ServiceHealthState>


getTracer()

getTracer(): Tracer

Defined in: core/types/ServiceClass.ts:69

get the opentelemetry tracer of the service

Returns

Tracer


pauseQueueWorkers()

pauseQueueWorkers(queueName, reason?): void

Defined in: core/types/ServiceClass.ts:94

Parameters

queueName

string

reason?

string

Returns

void


resumeQueueWorkers()

resumeQueueWorkers(queueName): void

Defined in: core/types/ServiceClass.ts:95

Parameters

queueName

string

Returns

void


resumeSubscriptionConsumer()

resumeSubscriptionConsumer(registrationKey): Promise<void>

Defined in: core/types/ServiceClass.ts:97

Parameters

registrationKey

string

Returns

Promise<void>


start()

start(): Promise<void>

Defined in: core/types/ServiceClass.ts:37

Start the service

Returns

Promise<void>


startActiveSpan()

startActiveSpan<F>(name, opts, context, fn): Promise<F>

Defined in: core/types/ServiceClass.ts:59

Start a new active opentelemetry span with given options. A active span will be below the current span in hierarchy

Type Parameters

F

F

Parameters

name

string

the name of the span

opts

SpanOptions

the additional span options

context

Context | undefined

the span context

fn

(span) => Promise<F>

the function to be wrapped into the span

Returns

Promise<F>


wrapInSpan()

wrapInSpan<F>(name, opts, fn, context?): Promise<F>

Defined in: core/types/ServiceClass.ts:48

Wrap the given function in an OpenTelemetry span. The span will be on same hierarchy level as the current span.

Type Parameters

F

F

Parameters

name

string

the name of the span

opts

SpanOptions

the additional span options

fn

(span) => Promise<F>

the function to be wrapped in span

context?

Context

the span context

Returns

Promise<F>