Skip to content

PURISTA API / Modules / @purista/core / ServiceClass

Interface: ServiceClass<ConfigType>

@purista/core.ServiceClass

The ServiceClass interface

Type parameters

NameType
ConfigTypeunknown | undefined

Implemented by

Table of contents

Properties

Methods

Properties

config

config: ConfigType

Defined in

core/types/ServiceClass.ts:12

Methods

destroy

destroy(): Promise<void>

Stop and destroy the current service

Returns

Promise<void>

Defined in

core/types/ServiceClass.ts:17


getTracer

getTracer(): Tracer

get the opentelemetry tracer of the service

Returns

Tracer

Defined in

core/types/ServiceClass.ts:54


registerCommand

registerCommand(commandDefinition): Promise<void>

Registers a new command for the service

Parameters

NameTypeDescription
commandDefinitionCommandDefinitionthe service command definition

Returns

Promise<void>

Defined in

core/types/ServiceClass.ts:60


registerSubscription

registerSubscription(subscriptionDefinition): Promise<void>

Registers a new subscription for the service

Parameters

NameTypeDescription
subscriptionDefinitionSubscriptionDefinitionthe subscription definition

Returns

Promise<void>

Defined in

core/types/ServiceClass.ts:66


start

start(): Promise<void>

Start the service

Returns

Promise<void>

Defined in

core/types/ServiceClass.ts:22


startActiveSpan

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

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

Type parameters

Name
F

Parameters

NameTypeDescription
namestringthe name of the span
optsSpanOptionsthe additional span options
contextundefined | Contextthe span context
fn(span: Span) => Promise<F>the function to be wrapped into the span

Returns

Promise<F>

Defined in

core/types/ServiceClass.ts:44


wrapInSpan

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

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

Type parameters

Name
F

Parameters

NameTypeDescription
namestringthe name of the span
optsSpanOptionsthe additional span options
fn(span: Span) => Promise<F>the function to be wrapped in span
context?Contextthe span context

Returns

Promise<F>

Defined in

core/types/ServiceClass.ts:33