Skip to main content

Interface: ServiceClass<ConfigType>


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:12open in new window

Methods

destroy

destroy(): Promise<void>

Stop and destroy the current service

Returns

Promise<void>

Defined in

core/types/ServiceClass.ts:17open in new window


getTracer

getTracer(): Tracer

get the opentelemetry tracer of the service

Returns

Tracer

Defined in

core/types/ServiceClass.ts:54open in new window


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:60open in new window


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:66open in new window


start

start(): Promise<void>

Start the service

Returns

Promise<void>

Defined in

core/types/ServiceClass.ts:22open in new window


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:44open in new window


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:33open in new window

Last update:
Contributors: Sebastian Wessel