You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Hilde <hi...@yahoo.de> on 2012/08/15 17:01:15 UTC

onCompletion with onWhen predicate

Hello folks!

I have figured out that onCompletion().onWhen() cannot be used multiple.

Actually onCompletion().onWhen() suggests to use it multiple erroneously. 
I wrote the following route:

from("seda:" + SedaDirectDestinations.SEDA_LOAD).routeId(ROUTE_ID)
   .onCompletion().onWhen(simple("${header.status} != 0"))
	.bean(loadPayloads, "finalFail")
	.to("activemq:topic:" + JmsDestinations.TOPIC_DASHBOARD_AUDITLOG)
   .end()
  .onCompletion().onWhen(simple("${header.status} == 0"))
	.bean(loadPayloads, "finalSuccess")
	.to("activemq:topic:" + JmsDestinations.TOPIC_DASHBOARD_AUDITLOG)
  .end()
...

But that doesn't work because the latter onCompletion().onWhen() overwrites
the first one.
onCompletion().onWhen() must not exist more than once.

Maybe you can publish that hint on http://camel.apache.org/oncompletion.html

cheers
Hilde



--
View this message in context: http://camel.465427.n5.nabble.com/onCompletion-with-onWhen-predicate-tp5717401.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: onCompletion with onWhen predicate

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Aug 15, 2012 at 5:01 PM, Hilde <hi...@yahoo.de> wrote:
> Hello folks!
>
> I have figured out that onCompletion().onWhen() cannot be used multiple.
>
> Actually onCompletion().onWhen() suggests to use it multiple erroneously.
> I wrote the following route:
>
> from("seda:" + SedaDirectDestinations.SEDA_LOAD).routeId(ROUTE_ID)
>    .onCompletion().onWhen(simple("${header.status} != 0"))
>         .bean(loadPayloads, "finalFail")
>         .to("activemq:topic:" + JmsDestinations.TOPIC_DASHBOARD_AUDITLOG)
>    .end()
>   .onCompletion().onWhen(simple("${header.status} == 0"))
>         .bean(loadPayloads, "finalSuccess")
>         .to("activemq:topic:" + JmsDestinations.TOPIC_DASHBOARD_AUDITLOG)
>   .end()
> ...
>
> But that doesn't work because the latter onCompletion().onWhen() overwrites
> the first one.
> onCompletion().onWhen() must not exist more than once.
>
> Maybe you can publish that hint on http://camel.apache.org/oncompletion.html
>

Thanks I have updated that page with a note about this.

> cheers
> Hilde
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/onCompletion-with-onWhen-predicate-tp5717401.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: onCompletion with onWhen predicate

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel are you using?

On Wed, Aug 15, 2012 at 5:01 PM, Hilde <hi...@yahoo.de> wrote:
> Hello folks!
>
> I have figured out that onCompletion().onWhen() cannot be used multiple.
>
> Actually onCompletion().onWhen() suggests to use it multiple erroneously.
> I wrote the following route:
>
> from("seda:" + SedaDirectDestinations.SEDA_LOAD).routeId(ROUTE_ID)
>    .onCompletion().onWhen(simple("${header.status} != 0"))
>         .bean(loadPayloads, "finalFail")
>         .to("activemq:topic:" + JmsDestinations.TOPIC_DASHBOARD_AUDITLOG)
>    .end()
>   .onCompletion().onWhen(simple("${header.status} == 0"))
>         .bean(loadPayloads, "finalSuccess")
>         .to("activemq:topic:" + JmsDestinations.TOPIC_DASHBOARD_AUDITLOG)
>   .end()
> ...
>
> But that doesn't work because the latter onCompletion().onWhen() overwrites
> the first one.
> onCompletion().onWhen() must not exist more than once.
>
> Maybe you can publish that hint on http://camel.apache.org/oncompletion.html
>
> cheers
> Hilde
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/onCompletion-with-onWhen-predicate-tp5717401.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen