xdave

Results 39 comments of xdave

I came up with this... maybe it'll be useful for someone. ```ts import { Type } from '@nestjs/common'; import { IEvent, ofType } from '@nestjs/cqrs'; import { pipe } from...

Yeah it's an inelegant solution, I haven't come up with anything else yet.

I just came across this problem, as I needed to inject db repositories into the command handlers which are configured for request-scoped multi-tenancy. The solution was to pass a repository...

@grexlort @kamilmysliwiec started using https://www.npmjs.com/package/express-http-context for this. Uses something called "continuation-local storage" (kind of like thread-local storage, but for nodejs) to keep track of some state during a request. I...

In order for this to work, each command, query, and event handler would have to somehow know what request initiated it after a long running process (for example) even long...

What I'm thinking about doing is creating a custom parameter decorator with this info and then having another parameter on all of my command, query, and event constructors that takes...

@rafaelkallis This is awesome! What kind of effort do you think it would take to refactor the existing busses (QueryBus, CommandBus, EventBus) to make it work like this and create...

I think figuring out how events and sagas fit into this would be helpful. While it would be useful to have 1:n request-scoped event handlers, it's probably not possible to...

@rafaelkallis I guess it wouldn't limit us, just curious to see what happens if a normally request-scoped command is executed by a saga or event handler outside of the request...

The problem with this is that any provider that is request scoped is automatically garbage collected after the request is complete. This prevents the Mediator from running continuously in the...