Arif K.
Arif K.

Reputation: 43

Apache Camel, IBM MQ integration

I want to use Apache Camel to send a message on IBM MQ and so I wrote a simple program, but I am getting error:

Exception in thread "main" org.apache.camel.NoSuchEndpointException: No endpoint could be found for: queuename, please check your classpath contains the needed Camel component jar.
    at org.apache.camel.impl.DefaultProducerTemplate.resolveMandatoryEndpoint(DefaultProducerTemplate.java:499)
    at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:167)

My code:

CamelContext context = new DefaultCamelContext();

//added that line after some checks but didnt help
context.addComponent("http", new HttpComponent());

 context.addComponent("test-jms",connFactory);

ProducerTemplate template = context.createProducerTemplate();

context.start();

template.sendBody("testQueueName", "Test  Message ");

testQueueName holds queuename.

I have all necessary dependencies in my pom.xml.

Upvotes: 1

Views: 2626

Answers (1)

Axel Podehl
Axel Podehl

Reputation: 4303

The first argument of sendBody() must be an Apache Camel Endpoint, for example "activemq:MyQueue". In other words, it must be one of these: http://camel.apache.org/uris.html

If you configured IBM MQ as your JMS provider, I guess this should work:

template.sendBody("jms:queue:testQueueName", "Test  Message ");

Upvotes: 1

Related Questions