-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
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
Problem when multiple workflows inherit from base class #112
Comments
Here is the error you will see when the registry handler tries to deliver the message to the wrong handler.
|
Going through the code a bit more it seems the target passed to addStep in handles.ts is always the base class. Even for message handlers that are only defined in the child workflows and not the base workflow. I'm going to just refactor my implementation since this scenario doesn't seem to be supported. :(
|
Hey @jabstone, it looks like you already worked this one out so I don't think there's anything else I can add. I had a look at your fork and as you know the decorator on the base class can only target itself and not what extends it. You'll know best how to refactor this - but as far as I can tell you'd likely end up along the lines of:
all the best |
Yep, that's exactly what I ended up doing. Works great now. Appreciate the response. |
Hello. I ran into a problem recently when you have multiple workflows that inherit from a common base class. In this scenario, calling initializeWorkflows will incorrectly register ALL message handlers (from every workflow) for each workflow. So message handlers from workflow A will also be registered for workflow B and vice versa. You can see this behavior when looking at the results of the getSteps method in the handles.js.
The end result is when the registry-handler tries to resolve the handler for a message, it incorrectly tries to send the message to the wrong handler. Eventually, the correct handler will be found and the message will be delivered, assuming you don't exhaust your message delivery retries. It seems the root cause is the Reflection.getMetadata is incorrectly returning handlers for the wrong targets when using inheritance. Either that or I'm just doing something really dumb and haven't figured out what yet. I modified the bus-starter project to demonstrate the issue. It can be found at: https://github.com/jabstone/bus-starter/tree/bug/InheritedWorkflowProblem
Any insight as to possible workarounds for this scenario would be appreciated.
The text was updated successfully, but these errors were encountered: