My simple camel route

public class MyCamel {
    
    private static final Logger LOGGER = LoggerFactory.getLogger(MyCamel.class); 
    
    public static void main(String[] args) throws Exception {
        
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("file:inbox").routeId("myRoute")
                    .process(new Processor() {
                        
                        @Override
                        public void process(Exchange exchange) throws Exception {
                            LOGGER.info("Received in body {}", exchange.getIn().getBody());
                        }
                    });
            }

        });
        context.start();
        Thread.sleep(5000); // Work for 5 secs and stops the route
    }

}
2014-10-09 14:50:54,836 | INFO  | main                                     | DefaultCamelContext                      | Apache Camel 2.10.4 (CamelContext: camel-1) is starting
2014-10-09 14:50:54,901 | INFO  | main                                     | ManagementStrategyFactory                | JMX enabled.
2014-10-09 14:50:55,042 | INFO  | main                                     | DefaultTypeConverter                     | Loaded 172 type converters
2014-10-09 14:50:55,249 | INFO  | main                                     | DefaultCamelContext                      | Route: myRoute started and consuming from: Endpoint[file://inbox]
2014-10-09 14:50:55,249 | INFO  | main                                     | DefaultManagementLifecycleStrategy       | StatisticsLevel at All so enabling load performance statistics
2014-10-09 14:50:55,255 | INFO  | main                                     | DefaultCamelContext                      | Total 1 routes, of which 1 is started.
2014-10-09 14:50:55,260 | INFO  | main                                     | DefaultCamelContext                      | Apache Camel 2.10.4 (CamelContext: camel-1) started in 0.421 seconds
2014-10-09 14:50:56,251 | INFO  | Camel (camel-1) thread #0 - file://inbox | MyCamel                                  | Received in body GenericFile[pom.xml]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s