You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sailaja p <sp...@progress.com> on 2009/09/06 13:36:29 UTC

Using Splitter in CBR


Hi All,

 I am using Camel1.5 version. I am trying to use a splitter inside the
Contest Based Router pattern. Below is my Java DSL route.
 

from("jms:queue:test").choice().when().xpath("/book/name").splitter().xpath("/book/price").to("jms:queue:PriceQ").to("direct:BookName").otherwise().to("jms:topic:Invalid"); 
 
 Whenever I add the splitter after the when processor, I am getting error at
Otherwise pattern.

 Is the way I am coding the route is right? 
 
 If not, please suggest me the right path.
  
Thanks,
Sailaja.
-- 
View this message in context: http://www.nabble.com/Using-Splitter-in-CBR-tp25316850p25316850.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Using Splitter in CBR

Posted by sailaja p <sp...@progress.com>.
Thanks a lot Claus. I worked fine.

Regards,
Sailaja.


Claus Ibsen-2 wrote:
> 
> On Sun, Sep 6, 2009 at 1:36 PM, sailaja p<sp...@progress.com> wrote:
>>
>>
>> Hi All,
>>
>>  I am using Camel1.5 version. I am trying to use a splitter inside the
>> Contest Based Router pattern. Below is my Java DSL route.
>>
>>
>> from("jms:queue:test").choice().when().xpath("/book/name").splitter().xpath("/book/price").to("jms:queue:PriceQ").to("direct:BookName").otherwise().to("jms:topic:Invalid");
>>
>>  Whenever I add the splitter after the when processor, I am getting error
>> at
>> Otherwise pattern.
>>
>>  Is the way I am coding the route is right?
>>
> 
> Yeah you need to denote the end of the splitted route so add .end()
> 
> from("jms:queue:test").choice().when().xpath("/book/name").splitter().xpath("/book/price").to("jms:queue:PriceQ").to("direct:BookName").end().otherwise().to("jms:topic:Invalid");
> 
> 
> 
> However its often more easily to use multiple route and use
> "direct:xxx" to link from one route to the other, such as:
> 
> from("jms:queue:test").choice().when().xpath("/book/name").to("direct:splitme").otherwise().to(....);
> 
> from("direct:splitme").splitter()....
> 
> 
>>  If not, please suggest me the right path.
>>
>> Thanks,
>> Sailaja.
>> --
>> View this message in context:
>> http://www.nabble.com/Using-Splitter-in-CBR-tp25316850p25316850.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-Use-Splitter-inside-the-CBR-Pattern-tp25316850p25331966.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Using Splitter in CBR

Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, Sep 6, 2009 at 1:36 PM, sailaja p<sp...@progress.com> wrote:
>
>
> Hi All,
>
>  I am using Camel1.5 version. I am trying to use a splitter inside the
> Contest Based Router pattern. Below is my Java DSL route.
>
>
> from("jms:queue:test").choice().when().xpath("/book/name").splitter().xpath("/book/price").to("jms:queue:PriceQ").to("direct:BookName").otherwise().to("jms:topic:Invalid");
>
>  Whenever I add the splitter after the when processor, I am getting error at
> Otherwise pattern.
>
>  Is the way I am coding the route is right?
>

Yeah you need to denote the end of the splitted route so add .end()

from("jms:queue:test").choice().when().xpath("/book/name").splitter().xpath("/book/price").to("jms:queue:PriceQ").to("direct:BookName").end().otherwise().to("jms:topic:Invalid");



However its often more easily to use multiple route and use
"direct:xxx" to link from one route to the other, such as:

from("jms:queue:test").choice().when().xpath("/book/name").to("direct:splitme").otherwise().to(....);

from("direct:splitme").splitter()....


>  If not, please suggest me the right path.
>
> Thanks,
> Sailaja.
> --
> View this message in context: http://www.nabble.com/Using-Splitter-in-CBR-tp25316850p25316850.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus