I have been given a task to take a text document that contains:

Doctor
Landscaper
Nurse
Plumber
Application_Developer
Electrician
System_Administrator

and organize them into other text files that separate Doctor and Nurse to a
Medical Directory, Application Developer and System Administrator into an IT
directory and everything else in an Other Directory. Right now my code just
organized one of the career choices into one of the correct Directories.
Could it have to do with my choice method? code below.

import org.apache.camel.builder.RouteBuilder;


public class HelloCamelRoute extends RouteBuilder {
        @Override
        public void configure() throws Exception {
                // TODO Auto-generated method stub
                System.out.println("Transferring files..."); 
                from("file:c:/temp/in")
                        .split().tokenize("\n", 1)
                
                
                .log("{$body}")
                        
                .choice()
                        .when(body().contains("Doctor"))
                                
.to("file:c:/temp/out/Medical_Directory/emp.txt")
                        .when(body().contains("Nurse"))
                                
.to("file:c:/temp/out/Medical_Directory/emp.txt")
                        .when(body().contains("Application_Developer"))
                                .to("file:c:/temp/out/IT_Directory/emp.txt")
                        .when(body().contains("System_Administrator"))
                                        
.to("file:c:/temp/out/IT_Directory/emp.txt")
                        .otherwise()
                                .to("file:c:/temp/out/Other_Directory/emp.txt");
                                
                
        }

}




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-choice-method-tp5792577.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to