apache / camel-karavan

Apache Camel Karavan a Low-code Data Integration Platform
https://camel.apache.org
Apache License 2.0
452 stars 156 forks source link

problem of the method language with filter pattern #553

Closed cristph closed 1 year ago

cristph commented 1 year ago

I'm using camel-karavan to delpoy my camel.yaml integration, code as below:

- route:
    from:
      uri: direct:test11
      steps:
        - filter:
            expression:
              method:
                ref: testCheck
                method: check
            steps:
              - bean:
                  ref: testCheck
                  method: check
                  beanType: com.test.TestCheck
    id: test11

and testCheck is a Spring Bean

@Component("testCheck")
public class TestCheck {

    @Handler
    public boolean check() {
        return true;
    }

}

when loading the route, I encountered the following problem:

org.apache.camel.FailedToCreateRouteException: Failed to create route test11 at: >>> Filter[bean[ref:testCheck method:check] -> [Bean[ref:testCheck method:check]]] <<< in route: Route(test11)[From[direct:test11] -> [Filter[bean[ref:testCh... because of NullPointerException
at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:241)
at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:75)
at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:878)
at org.apache.camel.impl.DefaultModel.addRouteDefinitions(DefaultModel.java:206)
at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:367)
at org.apache.camel.builder.RouteBuilder.populateOrUpdateRoutes(RouteBuilder.java:732)
at org.apache.camel.builder.RouteBuilder.updateRoutesToCamelContext(RouteBuilder.java:595)
at org.apache.camel.impl.engine.DefaultRoutesLoader.updateRoutes(DefaultRoutesLoader.java:192)
...
Caused by: java.lang.NullPointerException: null
at org.apache.camel.reifier.language.ExpressionReifier.createPredicate(ExpressionReifier.java:243)
at org.apache.camel.reifier.AbstractReifier.createPredicate(AbstractReifier.java:123)
at org.apache.camel.reifier.ExpressionReifier.createPredicate(ExpressionReifier.java:48)
at org.apache.camel.reifier.FilterReifier.createFilterProcessor(FilterReifier.java:43)
at org.apache.camel.reifier.FilterReifier.createProcessor(FilterReifier.java:33)
at org.apache.camel.reifier.FilterReifier.createProcessor(FilterReifier.java:25)
at org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:847)
at org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:588)
at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:237)
... 15 common frames omitted

It seems like that the method language does not work with the filter pattern, anyone can help? much appreciated!

camel-springboot: 3.18.4
camel-karavan: the latest 3.18.6
davsclaus commented 1 year ago

Yeah it seems like a bug in camel-core / yaml-dsl. I created a ticket https://issues.apache.org/jira/browse/CAMEL-18807

davsclaus commented 1 year ago

Okay the bug is fixed and will be in next releases 3.18.5 and 3.20.0

davsclaus commented 1 year ago

You can configure karavan to what Camel version it should use, so when 3.20.0 is out you can use that, or wait for 3.18.5 etc.

davsclaus commented 1 year ago

And please if you find other issues then you are very welcome to report here

cristph commented 1 year ago

You can configure karavan to what Camel version it should use, so when 3.20.0 is out you can use that, or wait for 3.18.5 etc.

ohhhhhhhh, thanks so much!
this is why I enjoy Camel !

cristph commented 1 year ago

And please if you find other issues then you are very welcome to report here

Yeah, I‘m always keeping following the development of Camel, that's a nice tour!