Skip to main content

Class: CommandWatcher

Defined in: watchers/command.watcher.ts:31

CommandWatcher tracks CQRS command execution in NestJS applications. Integrates with @nestjs/cqrs CommandBus to monitor command execution, capturing name, handler, status, duration, and results.

Implements​

  • OnModuleInit
  • OnModuleDestroy

Constructors​

Constructor​

new CommandWatcher(collector, nestlensConfig, commandBus?): CommandWatcher

Defined in: watchers/command.watcher.ts:44

Parameters​

collector​

CollectorService

nestlensConfig​

NestLensConfig

commandBus?​

CommandBusLike

Returns​

CommandWatcher

Methods​

onModuleDestroy()​

onModuleDestroy(): void

Defined in: watchers/command.watcher.ts:130

Puts back what it replaced.

The wrappers live on an object the application owns and keeps, so closing the module has to give it back. Otherwise the host goes on calling through a watcher whose collector is gone — and where a process builds the module more than once against the same object, as tests and nest start --hmr do, each round wraps the last: one call, one entry per layer.

Returns​

void

Implementation of​

OnModuleDestroy.onModuleDestroy


onModuleInit()​

onModuleInit(): void

Defined in: watchers/command.watcher.ts:56

Returns​

void

Implementation of​

OnModuleInit.onModuleInit