I'm trying to get a Camel RabbitMQ integration working, and just printing out queue messages to console.
Using the RabbitMQ web interface I can see connections ARE made, when I start my camel instance.
I've created a direct exchange called "test" , and a queue called "test" and bound them together.
Then I'm using the RabbitMQ web interface to publish a message to the exchange.
Here is the camel code I'm using, but I'm not seeing anything come out to my console and i'm not seeing any message receipt acknowledgement on the camel side. Camel is also not showing any 'consumers' connected.
public class IntegrationRouteFromRabbitMQBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
System.out.println("IntegrationRouteFromRabbitMQBuilder Instantiated");
from("rabbitmq://localhost/test?queue=test").to("stream:out");
}
}
I'm doing anything glaringly wrong? Or is there anything else I can try to get it wired up? I've tried adding a routing key as well with no luck.
Thanks
UPDATE To set this up I used this pattern: http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html which is the standalone launcher...
the only thing I'm doing is main.addRouteBuilder(new IntegrationRouteFromRabbitMQBuilder()); Which should set up the context and fire everything up, as I understand it.
public void boot() throws Exception {
// create a Main instance
main = new Main();
// enable hangup support so you can press ctrl + c to terminate the JVM
main.enableHangupSupport();
// add routes
main.addRouteBuilder(new IntegrationRouteFromRabbitMQBuilder());
// run until you terminate the JVM
System.out.println("Starting Camel. Use ctrl + c to terminate the JVM.\n");
main.run();
}
UPDATE 2
Adding error log output
17:05:09.886 [main] INFO o.a.camel.impl.DefaultCamelContext - Route: route1 started and consuming from: Endpoint[rabbitmq://localhost/test?exchangeType=fanout&queue=test&routingKey=test123]
17:05:09.886 [Camel (camel-1) thread #1 - RabbitMQConsumer] TRACE o.a.c.c.rabbitmq.RabbitMQConsumer - Creating connection...
17:05:09.886 [main] TRACE o.a.camel.support.ServiceSupport - Starting service
17:05:09.886 [main] TRACE org.apache.camel.util.EventHelper - Notification of event is disabled: Started route: route1
17:05:09.886 [main] DEBUG o.a.c.m.DefaultManagementLifecycleStrategy - Load performance statistics disabled
17:05:09.886 [main] INFO o.a.camel.impl.DefaultCamelContext - Total 1 routes, of which 1 is started.
17:05:09.887 [main] INFO o.a.camel.impl.DefaultCamelContext - Apache Camel 2.14.0 (CamelContext: camel-1) started in 0.573 seconds
17:05:09.888 [main] TRACE org.apache.camel.util.EventHelper - Notification of event is disabled: Started CamelContext: camel-1
17:05:09.889 [Camel (camel-1) thread #1 - RabbitMQConsumer] DEBUG o.a.c.c.rabbitmq.RabbitMQConsumer - Created connection: amqp://[email protected]:5672/
17:05:09.889 [Camel (camel-1) thread #1 - RabbitMQConsumer] TRACE o.a.c.c.rabbitmq.RabbitMQConsumer - Creating channel...
17:05:09.889 [Camel (camel-1) thread #1 - RabbitMQConsumer] DEBUG o.a.c.c.rabbitmq.RabbitMQConsumer - Created channel: AMQChannel(amqp://[email protected]:5672/,1)
17:05:09.890 [pool-3-thread-3] TRACE o.a.c.u.c.CamelThreadFactory - Created thread[Camel (camel-1) thread #2 - RabbitMQConsumer] -> Thread[Camel (camel-1) thread #2 - RabbitMQConsumer,5,main]