You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by james555 <lu...@gmx.net> on 2015/09/25 17:06:29 UTC
Print exchangeProperty value in throwException
Hello,
i would like to print the value of a exchangeProperty in a
throwException-Clause like this (Camel 2.15.3):
public void configure() throws Exception {
from("direct:start")
.setProperty("propertyX", constant(true))
.setProperty("propertyY", constant("hello"))
.choice()
.when(exchangeProperty("propertyX").isEqualTo(true))
.throwException(new Exception("message is " +
simple("${exchangeProperty.propertyY}")))
.end()
.process(new DummyErrorProcessor())
.end()
...
but I had no success, it doesn't print the value
...
Caused by: java.lang.Exception: Property is Simple:
${exchangeProperty.propertyY}
...
Any tipp here ?
--
View this message in context: http://camel.465427.n5.nabble.com/Print-exchangeProperty-value-in-throwException-tp5771983.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Print exchangeProperty value in throwException
Posted by james555 <lu...@gmx.net>.
Thanks, Clausfor your reply ! I will use future version 2.16.x for the
project. Greetings james
--
View this message in context: http://camel.465427.n5.nabble.com/Print-exchangeProperty-value-in-throwException-tp5771983p5772040.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Print exchangeProperty value in throwException
Posted by Claus Ibsen <cl...@gmail.com>.
In Camel 2.16 the simple language is supported in the message, so you can do:
.throwException(IllegalArgumentException.class, "Darn ${body} is
invalid")
In older releases you can not, and instead you can use a processor or
bean to throw the exception
On Fri, Sep 25, 2015 at 5:06 PM, james555 <lu...@gmx.net> wrote:
> Hello,
>
> i would like to print the value of a exchangeProperty in a
> throwException-Clause like this (Camel 2.15.3):
>
> public void configure() throws Exception {
> from("direct:start")
> .setProperty("propertyX", constant(true))
> .setProperty("propertyY", constant("hello"))
> .choice()
> .when(exchangeProperty("propertyX").isEqualTo(true))
> .throwException(new Exception("message is " +
> simple("${exchangeProperty.propertyY}")))
> .end()
> .process(new DummyErrorProcessor())
> .end()
>
> ...
>
> but I had no success, it doesn't print the value
> ...
> Caused by: java.lang.Exception: Property is Simple:
> ${exchangeProperty.propertyY}
> ...
>
> Any tipp here ?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Print-exchangeProperty-value-in-throwException-tp5771983.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition