flux icon indicating copy to clipboard operation
flux copied to clipboard

Flux doesn't support array of component references passed as contructor arg

Open grantnd opened this issue 9 years ago • 2 comments

When specifying a component such as myComponent in the following config yaml:

- components
  - id: "referencedComponent"
    className: "com.test.Foo"
    ...
  - id: "myComponent"
    className: "com.test.MyClass"
    constructorArgs:
      - [ ref: "referencedComponent" ]
      - "bar"

The reference in the list passed as the first contructor arg isn't dereferenced. Then when an attempt is made to instantiate MyClass in org.apache.storm.flux.FluxBuilder.buildObject, the first parameter is passed as an ArrayList of LinkedHashMap and an exception is thrown.

I can look at fixing this and making a pull request. Should that be done over in the main Storm project now that Flux is an external?

Alternatively, would you consider Flux providing the option of using Spring as a way to load components? e.g.

components:
   - springDefinition: "/path/to/springDefinition.xml"

grantnd avatar Jul 06 '15 10:07 grantnd

Hi @grantnd,

Yes, since this is incorporated into main Storm project, all modifications should take place there.

Also, could you provide the constructor signature of the class you are trying to use?

ptgoetz avatar Jul 07 '15 16:07 ptgoetz

Sure thing, in the above example it would be:

public MyClass(List<Foo> foos, String someString) { ... }

grantnd avatar Jul 09 '15 14:07 grantnd