I am having problems getting queue data from CamelContext. I am a newbie to Camel and so I just don't see what I am doing wrong.
I am using: Camel 2.15.2 ActiveMQ 5.11.1 I am using the following code to send data to the queue and it works (all of this is just test code to learn Camel). public static void putToEventQueue(String eventName, String eventStatus, String eventMessage) { init(); //Starts up ActiveMQ if it is not already started. CamelContext context = new DefaultCamelContext(); ProducerTemplate template = context.createProducerTemplate(); template.sendBody("vm://localhost:eventQueue", new EventMessage(eventName, eventStatus, eventMessage)); } If I use the following code to get data from ActiveMQ then it works (How I know that putToEventQueue is working). public void getFromQueue() { CamelContext context = new DefaultCamelContext(); ConsumerTemplate ct = context.createConsumerTemplate(); Object test = ct.receiveBody("vm://localhost:eventQueue"); while (test != null) { System.out.println("consumer Name:"+ ((EventMessage) test).getEventName()); System.out.println("consumer Message:"+ ((EventMessage) test).getEventMessage()); test = ct.receiveBody("vm://localhost:eventQueue"); } } But if I use the following CamelContext.addRoutes() code to get at the data it never retrieves any of the data from the queue. public void getFromQueue() { CamelContext context = new DefaultCamelContext(); context.addComponent("activemq", activeMQComponent("vm://localhost?broker.persistent=false")); try { context.addRoutes(new RouteBuilder() { public void configure() throws Exception { from("activemq:queue:eventQueue").to("browse:eventReceived"); } }); context.start(); Thread.sleep(10000); BrowsableEndpoint browse = context.getEndpoint("browse:eventReceived", BrowsableEndpoint.class); List<Exchange> exchanges = browse.getExchanges(); for (Exchange exchange : exchanges) { //If I set a break point here I never see data in exchanges. Object test = exchange.getIn().getBody(); System.out.println("consumer Name:"+ ((EventMessage) test).getEventName()); System.out.println("consumer Message:"+ ((EventMessage) test).getEventMessage()); } context.stop(); } catch (Exception e) { e.printStackTrace(); } } I have tried to look closely at the examples of using CamelContext to create a route from ActiveMQ but I am missing something in the mix because nothing ever makes it into the BrowsableEndpoint or exchanges from the ActiveMQ queue. Any suggestions in helping me to see what I am doing wrong is greatly appreciated.