Code Monkey home page Code Monkey logo

Comments (4)

adenhertog avatar adenhertog commented on June 30, 2024 1

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.

jabstone avatar jabstone commented on June 30, 2024

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.

jabstone avatar jabstone commented on June 30, 2024

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);
    }

image

from bus.

jabstone avatar jabstone commented on June 30, 2024

Yep, that's exactly what I ended up doing. Works great now. Appreciate the response.

from bus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.