【发布时间】:2019-04-12 05:23:17
【问题描述】:
我一直在尝试将 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();
}
我认为从 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();
}
由于我在后一种配置上没有找到太多帮助,所以我唯一的选择是使用 XML 配置吗?
请纠正/编辑/指出我犯的任何错误,仍在学习 Spring Integration DSL。
感谢您的帮助!
【问题讨论】:
-
tibcoEmsConnectionFactory不也是关于 JMS 的吗?Jms.messageDrivenChannelAdapter()不适合你吗? -
顺便说一句,你的 XML 是什么?
-
我尝试使用 Jms.inboudAdapter 和 Jms.messageDrivenChannelAdapter,但不断收到此编译错误 -
Cannot resolve method 'from(org.springframework.integration.dsl.jms.JmsMessageDrivenChannelAdapterSpec.JmsMessageDrivenChannelAdapterListenerContainerSpec<org.springframework.integration.dsl.jms.JmsDefaultListenerContainerSpec,org.springframework.jms.listener.DefaultMessageListenerContainer>)'我正在使用 spring-integration-core 5.0.7.RELEASE 和 spring-integration-java- dsl 1.2.2.RELEASE -
从 Spring Integration
5.0版本开始,您不应该将那个额外的工件用于 Java DSL。它现在包含在核心项目中。见github.com/spring-projects/spring-integration-java-dsl/wiki/…:This project has been absorbed by Spring Integration Core starting with version 5.0.
标签: spring spring-integration spring-integration-dsl tibco-ems