Reputation: 2485
I am trying to set up a basic route from File system to a JMS Destination running on ActiveMQ. My ActiveMQ server is running on localhost using default settings and has a Queue available at "activemq/queue/TestQueue".
So I have coded the following Java route:
public static void main(String args[]) throws Exception {
CamelContext context = new DefaultCamelContext();
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
"vm://localhost");
context.addComponent("jms",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
context.addRoutes(new RouteBuilder() {
public void configure() {
from("file:D:\\camel\\in").to(
"activemq:queue:TestQueue");
}
});
context.start();
Thread.sleep(10000);
context.stop();
}
Unfortunately the following Exception is raised:
Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[activemq:queue:TestQueue] <<< in route: Route(route1)[[From[file:D:\camel\in]] -> [To[activemq:queue... because of Failed to resolve endpoint: activemq://queue:TestQueue due to:
No component found with scheme: activemq
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:945)
. . . .
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: activemq://queue:TestQueue due to: No component found with scheme: activemq
I have tried with some other variations of the "to" route, such as "activemq:queue:activemq/queue/TestQueue" without success. Any idea how to make it work ?
Thanks
Upvotes: 0
Views: 6826
Reputation: 41
Your are probably missing the dependencies:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jms</artifactId>
<version>2.18.1</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
<version>5.6.0</version>
</dependency>
Upvotes: 4
Reputation: 4338
You have to use "tcp://0.0.0.0:61616" protocol for connecting to an external ActiveMQ server. Also it's strange you don't have any error message after posting to "vm:". Have you included all slfj logging libraries in your project?
Upvotes: 2
Reputation: 7646
As you named the JMS component jms
, you need to reference the queue as follows:
"jms:queue:TestQueue"
instead of
"activemq:queue:TestQueue"
Upvotes: 5