On Sun, May 24, 2009 at 1:14 AM, Rodrigo Valerio <[email protected]> wrote:
>
> Hello people.
> Please help me, i try to use choice after a split, tokenize and stream a
> file.
> But the code never goes to .choice, when i use body(File.class) to
> split/tokenize.
> If i use body(String.class) goes, but put all file in memory.
Basically you dont have to pass in the body type, so it should be:
split(body().tokenize("\n")).streaming()
I created an unit test based on your route:
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/FileSplitStreamingWithChoiceTest.java
BTW: Which version of Camel are you using. That information is crucial
for us to know to be able to better help you.
>
> public class RoteadorVisa extends RouteBuilder {
> �...@override
> public void configure() throws Exception {
>
> from("file:///tmp/files/?recursive=true&autoCreate=true&noop=true")
> //This runs ok. If i put body(String.class) instead of
> body(File.class)
> .split(body(File.class).tokenize("\n")).streaming()
> .process(new Processor(){
> public void process(Exchange exchange) throws
> Exception {
> System.out.println(exchange.getIn().getBody());
> }
> })
> //NEVER GOES HERE
> .choice()
> .when( body(String.class).isNotNull() )
> .process(new Processor(){
> public void process(Exchange exchange) throws
> Exception {
>
> System.out.println(exchange.getIn().getBody());
> }
> })
> .otherwise()
> .process(new Processor(){
> public void process(Exchange exchange) throws
> Exception {
>
> System.out.println(exchange.getIn().getBody());
> }
> })
> .end();
> }
> }
> --
> View this message in context:
> http://www.nabble.com/split-%2B-stream-%2B-choice%2C-what-wrong--tp23689175p23689175.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