【问题标题】:Apache Camel, IBM MQ integrationApache Camel、IBM MQ 集成
【发布时间】:2018-06-27 19:58:17
【问题描述】:

我想使用 Apache Camel 在 IBM MQ 上发送消息,所以我编写了一个简单的程序,但出现错误:

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)

我的代码:

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 持有queuename。

我的pom.xml 中有所有必要的依赖项。

【问题讨论】:

    标签: java apache-camel jms ibm-mq


    【解决方案1】:

    sendBody() 的第一个参数必须是 Apache Camel Endpoint,例如“activemq:MyQueue”。换句话说,它必须是以下之一:http://camel.apache.org/uris.html

    如果您将 IBM MQ 配置为您的 JMS 提供程序,我想这应该可以:

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

    【讨论】:

      猜你喜欢
      • 2018-02-08
      • 2016-05-05
      • 2018-02-10
      • 1970-01-01
      • 2016-05-07
      • 1970-01-01
      • 2019-08-27
      • 2020-04-02
      • 1970-01-01
      相关资源
      最近更新 更多