camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] [Updated] (CAMEL-10572) RefLanguage should support Predicates for Choice
Date Thu, 08 Dec 2016 20:08:58 GMT


Claus Ibsen updated CAMEL-10572:
    Estimated Complexity: Novice  (was: Unknown)

> RefLanguage should support Predicates for Choice
> ------------------------------------------------
>                 Key: CAMEL-10572
>                 URL:
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.18.1
>            Reporter: Christoph Läubrich
>            Priority: Minor
>             Fix For: 2.19.0
> The documentation for the CBR ( states

> {quote}The following example shows how to route ... depending on the evaluation of various
Predicate expressions{quote}
> If you now look at the predicate section ( it
> {quote}Camel supports extensible Predicates using multiple Languages; the following languages
are supported out of the box
> ...
> Ref Language
> ...{quote}But going to the Ref page ( it states{quote}The
Ref Expression Language is really just a way to lookup a custom Expression from the Registry.
> So Ref Language does NOT support Predicates, it works in most cases since nearly all
classes in Camel core implement Expresion and Predicate interface and there is a lot of converting
between those, but if you have a custom expression that only implements predicate, you get
in fact an (a bit misleading) exception:
> {quote}java.lang.IllegalArgumentException: Cannot find expression in registry with ref:
> 	at org.apache.camel.language.ref.RefLanguage$1.evaluate(
> 	at
> 	at
> 	at org.apache.camel.util.ExpressionToPredicateAdapter.matches(
> 	at org.apache.camel.processor.FilterProcessor.matches(
> 	at org.apache.camel.processor.ChoiceProcessor.process(
> 	at
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(
> 	at org.apache.camel.processor.CamelInternalProcessor.process(
> 	at org.apache.camel.processor.CamelInternalProcessor.process(
> 	at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(
> 	at org.apache.camel.component.timer.TimerConsumer${quote}
> It takes me some time to find out that Camel is in fact finding my bean but can't use
it, beside that its hard to work out why a predicate must also implement expression (Choice
it self requires an Predicate in fact, so it converts all expresions to Predicates).
> So the following improvements would be nice
> # Let RefLanguage send out some kind of TypeConverterException if it can't use the bean
as the desired type
> # Let Ref, if it finds that the referenced bean is a predicate, convert this to an expression
e.g with PredicateToExpressionAdapter

This message was sent by Atlassian JIRA

View raw message