You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by blommish <jo...@gmail.com> on 2015/04/14 11:00:44 UTC

Handling splitting and error handling

from("direct:inbound")
  .multicast().parallelProcessing().to("direct:a", "direct:b");

//message a
from("direct:a").processRef("processor_a").to("validator:a.xsd")
  .multicast().parallelProcessing().to("jms:q1", "jms:q2");

//message b
from("direct:b").processRef("processor_b").to("validator:b.xsd")
  .multicast().parallelProcessing().to("jms:q3", "jms:q4");

I only want to send the messages a and b to their JMS endpoints IF both A
and B has been validated without problems, if not the message should be sent
to the error queue.
The processors are transformers and will transform the messages to different
xsd versions



--
View this message in context: http://camel.465427.n5.nabble.com/Handling-splitting-and-error-handling-tp5765748.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Handling splitting and error handling

Posted by Willem Jiang <wi...@gmail.com>.
handled(true) just tell camel to keep on processing the message as the error is recovered.
So I think you still need use handled(false) in your onException.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 15, 2015 at 5:22:21 PM, blommish (johanblomgren1988@gmail.com) wrote:
> So well, this can be handled by using transacted() after picking up the
> message from direct:inbound, making it look like:
>  
> from("direct:inbound")
> .transacted()
> .multicast().parallelProcessing().to("direct:a", "direct:b");
>  
> But there's another issue then.
>  
> If I have
> onException(Exception.class).handled(true).useOriginalMessage().to("jms:errorQueue")  
>  
> It WILL not rollback the messages from the endpoints, for example if it
> fails to validate for message a, it will still send the message b to q3 and
> q4.
>  
> But when having handled(false) it will not. But then it *will also rollback
> the message to the inbound queue* AND post it to the errorQueue?
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Handling-splitting-and-error-handling-tp5765748p5765819.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: Handling splitting and error handling

Posted by blommish <jo...@gmail.com>.
So well, this can be handled by using transacted() after picking up the
message from direct:inbound, making it look like:

from("direct:inbound")
  .transacted() 
  .multicast().parallelProcessing().to("direct:a", "direct:b");

But there's another issue then. 

If I have
onException(Exception.class).handled(true).useOriginalMessage().to("jms:errorQueue")

It WILL not rollback the messages from the endpoints, for example if it
fails to validate for message a, it will still send the message b to q3 and
q4. 

But when having handled(false) it will not. But then it *will also rollback
the message to the inbound queue* AND post it to the errorQueue? 



--
View this message in context: http://camel.465427.n5.nabble.com/Handling-splitting-and-error-handling-tp5765748p5765819.html
Sent from the Camel - Users mailing list archive at Nabble.com.