【发布时间】:2018-03-15 05:46:10
【问题描述】:
我想在 Spring Boot 项目中使用 Apache Camel 在 IBM MQ 上获取消息。 我使用基于 sprin boot 注释。 我没有找到任何完整的例子:pom.xml、receiver、configuration class...
有人帮我吗?任何链接、文档、...?
非常感谢
【问题讨论】:
标签: spring apache-camel websphere ibm-mq
我想在 Spring Boot 项目中使用 Apache Camel 在 IBM MQ 上获取消息。 我使用基于 sprin boot 注释。 我没有找到任何完整的例子:pom.xml、receiver、configuration class...
有人帮我吗?任何链接、文档、...?
非常感谢
【问题讨论】:
标签: spring apache-camel websphere ibm-mq
看看a new Spring Boot Starter for MQ,这可能会有所帮助。自述文件展示了如何修改 JMS 入门示例 here 以使用 IBM MQ 而不是 ActiveMQ。 MQ jars - 包括这个 starter - 都在 Maven Central 上以便于访问。
【讨论】:
您可以搜索一个使用 Spring Boot、Camel 和 ActiveMQ 的示例来获得第一印象。由于您使用 Camel,因此应该隐藏 IBM MQ 和 ActiveMQ 之间的大部分差异。
但是,你必须使用标准的JMS component,而不是骆驼专用的ActiveMQ component。
【讨论】:
在您的 Application 类中,您需要为 IBM 组件创建一个 bean,我只是在 spring xml 中为一个应用程序创建了一个 bean,如下所示:
<bean id="cf" class="com.ibm.mq.jms.MQConnectionFactory">
<property name="transportType" value="1" />
<property name="hostName" value="localhost" />
<property name="port" value="1414" />
<property name="queueManager" value="QMGRSCORE" />
<property name="channel" value="EXTAPP.SRVCONN" />
</bean>
但是一旦我在 Spring Boot 中为 MongDB 做了一个 bean 连接,你可以这样做:
@Bean(name = "myDb")
public MongoClient myDb() {
return new MongoClient();
}
但是将 IBM 值放在这个 bean 中。
【讨论】: