We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a issue when i want to log all commands, lets say I have a few commands and I want to log all commands that are run for auditing.
a middleware chain that can be registered onto the command or query bus.
middleware class and decorator to register (maybe with filters)
middleware class should have a handle method (like a command handler or queryhandler) that has 2 arguments command/query and a next function
small example
@Middleware() export class LogMiddleware implements IMiddleware<any, any> { handle(command: ICommand, next: NextFunction): any { console.log(command); return next(command); } }
this allows for adding functionality without changing behaviour.
The text was updated successfully, but these errors were encountered:
For your information, you can already do it using the ExplorerService: https://github.com/nestjs/cqrs/blob/master/src/services/explorer.service.ts
Sorry, something went wrong.
You can attach a side-effect by subscribing to the CommandBus stream. Command cannot be mutated though (and that's the desired behavior).
CommandBus
No branches or pull requests
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
I have a issue when i want to log all commands, lets say I have a few commands and I want to log all commands that are run for auditing.
Describe the solution you'd like
a middleware chain that can be registered onto the command or query bus.
middleware class and decorator to register (maybe with filters)
middleware class should have a handle method (like a command handler or queryhandler) that has 2 arguments
command/query and a next function
Teachability, documentation, adoption, migration strategy
small example
What is the motivation / use case for changing the behavior?
this allows for adding functionality without changing behaviour.
The text was updated successfully, but these errors were encountered: