Comments (4)
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:
- composing the logic via injectors into each workflow
- continuing to inherit, but add a handler decorator at the concrete class level that calls its base class
- having a separate dedicated child workflow
all the best
from bus.
Here is the error you will see when the registry handler tries to deliver the message to the wrong handler.
2021-03-19T21:53:16.160Z warn: Message was unsuccessfully handled. Returning to queue [object Object] {
"name": "ServiceBus",
"error": {
"name": "TypeError",
"message": "Cannot read property 'bind' of undefined",
"stack": "TypeError: Cannot read property 'bind' of undefined\n at Binding.handler [as dynamicValue] (/home/joe/github/bus-starter/node_modules/@node-ts/bus-workflow/dist/workflow/registry/workflow-registry.js:94:71)\n at /home/joe/github/bus-starter/node_modules/inversify/lib/resolution/resolver.js:64:118\n at invokeFactory (/home/joe/github/bus-starter/node_modules/inversify/lib/resolution/resolver.js:11:16)\n at /home/joe/github/bus-starter/node_modules/inversify/lib/resolution/resolver.js:64:26\n at Object.resolve (/home/joe/github/bus-starter/node_modules/inversify/lib/resolution/resolver.js:97:12)\n at /home/joe/github/bus-starter/node_modules/inversify/lib/container/container.js:321:37\n at Container._get (/home/joe/github/bus-starter/node_modules/inversify/lib/container/container.js:312:44)\n at Container.get (/home/joe/github/bus-starter/node_modules/inversify/lib/container/container.js:232:21)\n at Object.resolveHandler (/home/joe/github/bus-starter/node_modules/@node-ts/bus-core/dist/handler/handler-registry.js:66:38)\n at dispatchMessageToHandler (/home/joe/github/bus-starter/node_modules/@node-ts/bus-core/dist/service-bus/service-bus.js:138:41)"
from bus.
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. :(
static addStep(metadata, target) {
reflect_extensions_1.ReflectExtensions.defineMetadata(exports.WORKFLOW_HANDLES_METADATA_KEY, metadata, target.constructor);
}
from bus.
Yep, that's exactly what I ended up doing. Works great now. Appreciate the response.
from bus.
Related Issues (20)
- Construct workflows using container during mapping
- Port middleware over to master HOT 1
- RabbitMQ queue and exchange setup HOT 8
- The memory-queue is inappropriately deleting messages HOT 1
- Broken links in docs HOT 1
- Delay a retry by X seconds HOT 1
- Vulnerability in url-parse - dependency of amqplib HOT 1
- Rabbitmq transport polling HOT 2
- IoC with loopback HOT 4
- Named export <nameExport> not found HOT 2
- [bus-class-serializer]: package.json missing attributes HOT 1
- [Bug] Rabbitmq-transport.ts does not have reconnection if channel gets disconnected by some reasons
- How to setup DI container, when workflow needs the bus instance HOT 2
- Open to update `bus-sqs` to aws-sdk v3? HOT 1
- Support Mognodb Persistence for Workflows
- RabbitMQ transport doesn't allow custom message headers. HOT 4
- Problem with lodash and persisting workflow state
- Stuck workflows with error: "No existing workflow state found for message. Ignoring"
- [Feat] Support passing message and message context to Container Adapter HOT 1
- Persistent messages are not supported. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bus.