Skip to main content

JetstreamHealthIndicator

Defined in: src/health/jetstream.health-indicator.ts:22

Health indicator result compatible with @nestjs/terminus.

Follows the Terminus convention: returns status object on success, throws on failure. Works with Terminus out of the box — no wrapper needed:

Example

// With Terminus
this.health.check([() => this.jetstream.isHealthy()])

// Standalone
const status = await this.jetstream.check();

Constructors

Constructor

new JetstreamHealthIndicator(connection): JetstreamHealthIndicator

Defined in: src/health/jetstream.health-indicator.ts:25

Parameters

connection

ConnectionProvider

Returns

JetstreamHealthIndicator

Methods

check()

check(): Promise<JetstreamHealthStatus>

Defined in: src/health/jetstream.health-indicator.ts:35

Plain health status check.

Returns the current connection status without throwing. Use this for custom health endpoints or monitoring integrations.

Returns

Promise<JetstreamHealthStatus>

Connection status with server URL and RTT latency.


isHealthy()

isHealthy(key?): Promise<Record<string, Record<string, unknown>>>

Defined in: src/health/jetstream.health-indicator.ts:66

Terminus-compatible health check.

Returns { [key]: { status: 'up', ... } } on success. Throws an error with { [key]: { status: 'down', ... } } on failure.

Parameters

key?

string = 'jetstream'

Health indicator key (default: 'jetstream').

Returns

Promise<Record<string, Record<string, unknown>>>

Object with status, server, and latency under the given key.

Throws

Error with { [key]: { status: 'down' } } when disconnected.