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/03/11 11:54:05 UTC

Splitting xml - Send all items or send XML to Error Queue

Hi,

So I have a XML data which i will split, transform every item, send every
item to validator and then send to an endpoint.
But I want to be sure all items validate before sending them to the
endpoint, so its All or None, if an error would arise on any item I want to
send the XML data(before splitting) to my ErrorQueue.

How could I achieve this?

Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Splitting-xml-Send-all-items-or-send-XML-to-Error-Queue-tp5764002.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Splitting xml - Send all items or send XML to Error Queue

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

You can likely do a composed message processor EIP (see using splitter
only option) to split and build each sub message, and validate. And in
the agg strategy you just add each sub message to a list

And in case of validation error you can thrown an exception, and use
the sharedUnitOfWork option, and the useOriginalMessage
on the error handler, to send that message to the error queue - and
use stop on exception - then the splitter will break out asap.

If no validation error then route to a 2nd split afterwards to send
each splitter message.


http://camel.apache.org/composed-message-processor.html
http://camel.apache.org/splitter.html


On Wed, Mar 11, 2015 at 11:54 AM, blommish <jo...@gmail.com> wrote:
> Hi,
>
> So I have a XML data which i will split, transform every item, send every
> item to validator and then send to an endpoint.
> But I want to be sure all items validate before sending them to the
> endpoint, so its All or None, if an error would arise on any item I want to
> send the XML data(before splitting) to my ErrorQueue.
>
> How could I achieve this?
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Splitting-xml-Send-all-items-or-send-XML-to-Error-Queue-tp5764002.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Splitting xml - Send all items or send XML to Error Queue

Posted by majid <mo...@peerius.com>.
You can put your validated items into a temp seda queue and once you complete
the splitting of your file and you don't find any invalid item, then start
consuming the temp seda queue, otherwise just stop. 



--
View this message in context: http://camel.465427.n5.nabble.com/Splitting-xml-Send-all-items-or-send-XML-to-Error-Queue-tp5764002p5764012.html
Sent from the Camel - Users mailing list archive at Nabble.com.