Skip to main content

JetstreamModule

@horizon-republic/nestjs-jetstream


@horizon-republic/nestjs-jetstream / JetstreamModule

JetstreamModule

Defined in: src/jetstream.module.ts:158

Implements​

  • OnApplicationBootstrap
  • OnApplicationShutdown

Constructors​

Constructor​

new JetstreamModule(shutdownManager?, registry?): JetstreamModule

Defined in: src/jetstream.module.ts:159

Parameters​

shutdownManager?​

ShutdownManager

registry?​

ConnectionRegistry

Returns​

JetstreamModule

Methods​

onApplicationBootstrap()​

onApplicationBootstrap(): Promise<void>

Defined in: src/jetstream.module.ts:441

Verify every configured connection actually started.

Runs after startAllMicroservices() in a hybrid application.

Returns​

Promise<void>

Implementation of​

OnApplicationBootstrap.onApplicationBootstrap


onApplicationShutdown()​

onApplicationShutdown(): Promise<void>

Defined in: src/jetstream.module.ts:451

Gracefully shut down the transport on application termination.

Returns​

Promise<void>

Implementation of​

OnApplicationShutdown.onApplicationShutdown


forFeature()​

static forFeature(options): DynamicModule

Defined in: src/jetstream.module.ts:243

Register a lightweight client proxy for a target service.

Reuses the NATS connection from forRoot(). Import in each feature module that needs to communicate with a specific service. Pass connection to publish on a named connection instead of the default one.

Parameters​

options​

JetstreamFeatureOptions

Feature options with target service name.

Returns​

DynamicModule

Dynamic module with the client provider.


forRoot()​

static forRoot(options): DynamicModule

Defined in: src/jetstream.module.ts:177

Register the JetStream transport globally.

Creates a shared NATS connection, codec, event bus, and optionally the full consumer infrastructure (streams, consumers, routers).

Parameters​

options​

JetstreamModuleOptions

Module configuration.

Returns​

DynamicModule

Dynamic module ready to be imported.


forRootAsync()​

static forRootAsync(asyncOptions): DynamicModule

Defined in: src/jetstream.module.ts:209

Register the JetStream transport globally with async configuration.

Supports useFactory, useExisting, and useClass patterns for loading configuration from ConfigService, environment, etc.

Parameters​

asyncOptions​

JetstreamModuleAsyncOptions

Async configuration.

Returns​

DynamicModule

Dynamic module ready to be imported.