PURISTA API / @purista/core / ServiceClass
Interface: ServiceClass<S>
Defined in: packages/core/src/core/types/ServiceClass.ts:13
The ServiceClass interface
Type Parameters
• S extends ServiceClassTypes
= ServiceClassTypes
Properties
config
config:
S
["ConfigType"
]
Defined in: packages/core/src/core/types/ServiceClass.ts:14
resources
resources:
S
["Resources"
]
Defined in: packages/core/src/core/types/ServiceClass.ts:15
Methods
destroy()
destroy():
Promise
<void
>
Defined in: packages/core/src/core/types/ServiceClass.ts:20
Stop and destroy the current service
Returns
Promise
<void
>
getTracer()
getTracer():
Tracer
Defined in: packages/core/src/core/types/ServiceClass.ts:57
get the opentelemetry tracer of the service
Returns
Tracer
registerCommand()
registerCommand(
commandDefinition
):Promise
<void
>
Defined in: packages/core/src/core/types/ServiceClass.ts:63
Registers a new command for the service
Parameters
commandDefinition
CommandDefinition
<any
, any
, any
, any
, any
, any
, any
, any
, any
, any
, any
, any
, any
>
the service command definition
Returns
Promise
<void
>
registerSubscription()
registerSubscription(
subscriptionDefinition
):Promise
<void
>
Defined in: packages/core/src/core/types/ServiceClass.ts:71
Registers a new subscription for the service
Parameters
subscriptionDefinition
SubscriptionDefinition
<any
, any
, any
, any
, any
, any
, any
, any
, any
, any
, any
>
the subscription definition
Returns
Promise
<void
>
start()
start():
Promise
<void
>
Defined in: packages/core/src/core/types/ServiceClass.ts:25
Start the service
Returns
Promise
<void
>
startActiveSpan()
startActiveSpan<
F
>(name
,opts
,context
,fn
):Promise
<F
>
Defined in: packages/core/src/core/types/ServiceClass.ts:47
Start a new active opentelemetry span with given options. A active span will be below the current span in hierarchy
Type Parameters
• F
Parameters
name
string
the name of the span
opts
SpanOptions
the additional span options
context
the span context
undefined
| 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: packages/core/src/core/types/ServiceClass.ts:36
Wrap the given function in a opententelemetry span. The span will be on same hierarchy level as the current span.
Type Parameters
• 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
>