# ServiceClass API

The ServiceClass interface

---
Canonical: /handbook/api/interfaces/_purista_core.ServiceClass/
Source: core/types/ServiceClass.ts
Format: Markdown for agents
---

The ServiceClass interface

Package: `@purista/core`

## Signature

```typescript
interface ServiceClass<S>
```

## Members

### Properties

- `__serviceClassTypes: S` — Type-only anchor used to preserve cascading service builder types.
- `config: S["ConfigType"]`
- `resources: S["Resources"]`

### Methods

- `destroy(): Promise<void>` — Stop and destroy the current service
- `getContextFunctions(logger: Logger): ContextBase<S["Metrics"]>`
- `getInFlightDiagnostics(): InFlightDiagnostics`
- `getPausedSubscriptionConsumerState(): PausedSubscriptionConsumersByRegistrationKey`
- `getQueueWorkerPauseState(): QueueWorkerPauseStateByQueue`
- `getServiceHealth(): Promise<ServiceHealthState>`
- `getTracer(): Tracer` — get the opentelemetry tracer of the service
- `pauseQueueWorkers(queueName: string, reason?: string): void`
- `resumeQueueWorkers(queueName: string): void`
- `resumeSubscriptionConsumer(registrationKey: string): Promise<void>`
- `start(): Promise<void>` — Start the service
- `startActiveSpan<F>(name: string, opts: SpanOptions, context: Context | undefined, fn: (span: Span) => Promise<F>): Promise<F>` — Start a new active opentelemetry span with given options.
A active span will be below the current span in hierarchy
- `wrapInSpan<F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context): Promise<F>` — Wrap the given function in an OpenTelemetry span.
The span will be on same hierarchy level as the current span.
