Ade*_*e J 5 spring tibco-ems spring-integration spring-integration-dsl
我一直在尝试配置 Spring Integration dsl 以从 Tibco EMS 主题读取,对收到的消息进行一些处理,然后将其推送到 ActiveMQ 队列。我能够使用 XML 配置成功地设置它,但想改用 spring 集成 dsl。我无法弄清楚,也无法在网上找到任何相关帮助。
我将消息推送到 ActiveMQ 的配置是这样的 -
@Bean
public IntegrationFlow toActiveMQFlow(
MessageChannel channel,
ActiveMQQueue queue,
CachingConnectionFactory cachingConnectionFactory) {
return IntegrationFlows.from(channel)
.transform(Object::toString)
.handle(Jms.outboundAdapter(cachingConnectionFactory).destination(queue))
.get();
}
Run Code Online (Sandbox Code Playgroud)
我认为从 Tibco EMS 主题读取的配置应该是这样的 -
@Bean
public IntegrationFlow fromTibcoTopicFlow(
MessageChannel channel,
ConnectionFactory tibcoEmsConnectionFactory,
Topic tibcoTopic
) {
return IntegrationFlows
.from(SomeInboundAdapter(tibcoEmsConnectionFactory).destination(tibcoTopic))
.transform(Object::toString)
.channel(channel)
.get();
}
Run Code Online (Sandbox Code Playgroud)
由于我在后一种配置上没有找到太多帮助,因此求助于 XML 配置是我唯一的选择吗?
请纠正/编辑/指出我仍在学习 Spring Integration DSL 时所犯的任何错误。
感谢你的帮助!
您需要使用一个Jms.messageDrivenChannelAdapter(ConnectionFactory connectionFactory).
并且不应该使用spring-integration-java-dsl. 自版本以来,它已合并到核心项目5.0:https ://docs.spring.io/spring-integration/docs/5.0.9.RELEASE/reference/html/whats-new.html#_java_dsl
我们已经修复了类路径上旧 Java DSL jar 的问题: https: //jira.spring.io/browse/INT-4551
| 归档时间: |
|
| 查看次数: |
1066 次 |
| 最近记录: |