No quite. I know that If I want to create a separate class for the route i
can do this...

public class MyRouteBuilder extends RouteBuilder {      
        @Override
        public void configure() throws Exception {
                from("file:src/data?noop=true")         
        .split(stax(Record.class)).streaming()
                .to("mock:records");
        }    
}

And then I can call it from a Main...

public class MainApp {
    public static void main(String... args) throws Exception {
        Main main = new Main();
        main.enableHangupSupport();
        main.addRouteBuilder(new MyRouteBuilder());
        main.run(args);
    }
}

But what I am confused about is where would I place the bit where the
endpoint is injected in etc...
        @EndpointInject(uri = "mock:records")
        public static MockEndpoint recordsEndpoint;

and then...

        recordsEndpoint.expectedMessageCount(10);
        recordsEndpoint.allMessages().body().isInstanceOf(Record.class);
        recordsEndpoint.assertIsSatisfied();
        Record five =
recordsEndpoint.getReceivedExchanges().get(4).getIn().getBody(Record.class);

I'm asking because everywhere I put that code I can't get it to work. Yet in
the unit test it works perfectly!

appreciate your advice.






--
View this message in context: 
http://camel.465427.n5.nabble.com/Help-to-re-write-route-tp5741339p5741381.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to