Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7BE33200BF8 for ; Thu, 8 Dec 2016 21:09:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7A9E8160B2C; Thu, 8 Dec 2016 20:09:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B8121160B1F for ; Thu, 8 Dec 2016 21:08:59 +0100 (CET) Received: (qmail 23145 invoked by uid 500); 8 Dec 2016 20:08:58 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 23114 invoked by uid 99); 8 Dec 2016 20:08:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2016 20:08:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 7E82A2C03E4 for ; Thu, 8 Dec 2016 20:08:58 +0000 (UTC) Date: Thu, 8 Dec 2016 20:08:58 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAMEL-10572) RefLanguage should support Predicates for Choice MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 08 Dec 2016 20:09:00 -0000 [ https://issues.apache.org/jira/browse/CAMEL-10572?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-10572: -------------------------------- Estimated Complexity: Novice (was: Unknown) > RefLanguage should support Predicates for Choice > ------------------------------------------------ > > Key: CAMEL-10572 > URL: https://issues.apache.org/jira/browse/CAMEL-10572 > Project: Camel > Issue Type: Improvement > Components: camel-core > Affects Versions: 2.18.1 > Reporter: Christoph L=C3=A4ubrich > Priority: Minor > Fix For: 2.19.0 > > > The documentation for the CBR (http://camel.apache.org/content-based-rout= er.html) states=20 > {quote}The following example shows how to route ... depending on the eval= uation of various Predicate expressions{quote} > If you now look at the predicate section (http://camel.apache.org/predica= te.html) it says: > {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 (http://camel.apache.org/ref-language= .html) it states{quote}The Ref Expression Language is really just a way to = lookup a custom Expression from the Registry. {quote} > So Ref Language does NOT support Predicates, it works in most cases since= nearly all classes in Camel core implement Expresion and Predicate interfa= ce 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 misle= ading) exception: > {quote}java.lang.IllegalArgumentException: Cannot find expression in regi= stry with ref: predicate > =09at org.apache.camel.language.ref.RefLanguage$1.evaluate(RefLanguage.ja= va:50) > =09at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapt= er.java:36) > =09at org.apache.camel.support.ExpressionSupport.matches(ExpressionSuppor= t.java:32) > =09at org.apache.camel.util.ExpressionToPredicateAdapter.matches(Expressi= onToPredicateAdapter.java:35) > =09at org.apache.camel.processor.FilterProcessor.matches(FilterProcessor.= java:65) > =09at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.= java:93) > =09at org.apache.camel.management.InstrumentationProcessor.process(Instru= mentationProcessor.java:77) > =09at org.apache.camel.processor.RedeliveryErrorHandler.process(Redeliver= yErrorHandler.java:542) > =09at org.apache.camel.processor.CamelInternalProcessor.process(CamelInte= rnalProcessor.java:197) > =09at org.apache.camel.processor.CamelInternalProcessor.process(CamelInte= rnalProcessor.java:197) > =09at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(Ti= merConsumer.java:192) > =09at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.= java:76){quote} > It takes me some time to find out that Camel is in fact finding my bean b= ut 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 t= his to an expression e.g with PredicateToExpressionAdapter -- This message was sent by Atlassian JIRA (v6.3.4#6332)