You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an existing issue that is already proposing this?
I have searched the existing issues
Is your feature request related to a problem? Please describe it
Currently the nestjs/cqrs doesn't support request scoped dependencies into the handlers. Thus, if a @CommandHandler provider depends on another provider marked as Request Scoped, this provider comes as undefined. That also impacts multi-tenancy applications.
Describe the solution you'd like
pseudocode
publicasyncexecute<TCommandextendsICommand,TResultextendsIResult>(command: TCommand): Promise<TResult>{constcommandName=command.constructor.name;lethandler= this.commandRegister.getHandlerSingleton(commandName);if(!handler){consthandlerType=this.commandRegister.getHandlerType(commandName);constcontextId=ContextIdFactory.getByRequest(this.request);if(handlerType){this.moduleRef.registerRequestByContextId({ ... this.context},contextId,);handler=awaitthis.moduleRef.resolve(handlerType,contextId,{strict: false});}}if(!handler){thrownewError(`Command handler not found for ${commandName}`);}returnhandler.execute(command);}
I know there is the commandId instead of commandName to identify the commands. This is just an a example.
And I'm able to create and send a pull request to contribute to this. However, the last PR hung for three years without merging. I'd like to understand if it's worthwhile to move on with the contribution or if it's something that I should wait for other contributors.
I wouldn't want to open a PR and close after three years as the last person did.
I implemented my own version of the feature and I'm using it currently in the place of nestjs/cqrs. But I want to become a contributor so I imagine this is a good opportunity.
I created this new issue because I'm not able to answer the mentioned one.
petrusdemelo
changed the title
Enable multi tenancy support with Request Scoped/Durable Providers
Support with Request Scoped/Durable Providers
Apr 15, 2024
petrusdemelo
changed the title
Support with Request Scoped/Durable Providers
Support for Request Scoped/Durable Providers
Apr 15, 2024
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
Currently the nestjs/cqrs doesn't support request scoped dependencies into the handlers. Thus, if a @CommandHandler provider depends on another provider marked as Request Scoped, this provider comes as undefined. That also impacts multi-tenancy applications.
Describe the solution you'd like
pseudocode
I know there is the commandId instead of commandName to identify the commands. This is just an a example.
Teachability, documentation, adoption, migration strategy
Send a pull request that handles with the instantiation of the handlers request scoped and respect the strategy applied ContextIdFactory
What is the motivation / use case for changing the behavior?
Use nestjs/cqrs in a multi tenancy application.
The text was updated successfully, but these errors were encountered: