Skip to content

PipelineBootstrap

Defined in: packages/nestjs/src/pipeline/pipeline.bootstrap.ts:74

Wraps every @nestjs/cqrs handler that runs behaviors with its pipeline, at application bootstrap: execute of command and query handlers, handle of event handlers. The buses read the method at call time, so they dispatch through the pipeline unchanged.

A handler’s pipeline comes from its @UsePipeline/@SkipPipeline and the global behaviors, compiled once. Each behavior instance is the one provider a module registers under the behavior class; this provider never builds one. Startup fails when a behavior has no provider or several, when a handler that runs behaviors is request-scoped (Nest builds such a handler per request, so a wrapped instance would never run), and, in 'strict' mode, when a behavior’s contract is broken. Only this application’s own handler instances are wrapped, never their class, and they are restored when the application closes.

  • OnApplicationBootstrap
  • OnModuleDestroy

new PipelineBootstrap(discovery, options): PipelineBootstrap

Defined in: packages/nestjs/src/pipeline/pipeline.bootstrap.ts:80

DiscoveryService

PipelineOptions

PipelineBootstrap

onApplicationBootstrap(): void

Defined in: packages/nestjs/src/pipeline/pipeline.bootstrap.ts:85

void

OnApplicationBootstrap.onApplicationBootstrap


onModuleDestroy(): void

Defined in: packages/nestjs/src/pipeline/pipeline.bootstrap.ts:94

void

OnModuleDestroy.onModuleDestroy