使用Spring集成DSL阅读Tibco EMS主题
我一直在尝试将spring integration dsl配置为从Tibco EMS主题读取,对接收到的消息进行一些处理,然后将其推送到ActiveMQ队列。我能够使用XML配置成功地设置它,但我想改用SpringIntegrationDSL。我想不出来,在网上也找不到任何帮助 我将消息推送到ActiveMQ的配置如下-使用Spring集成DSL阅读Tibco EMS主题,spring,spring-integration,spring-integration-dsl,tibco-ems,Spring,Spring Integration,Spring Integration Dsl,Tibco Ems,我一直在尝试将spring integration dsl配置为从Tibco EMS主题读取,对接收到的消息进行一些处理,然后将其推送到ActiveMQ队列。我能够使用XML配置成功地设置它,但我想改用SpringIntegrationDSL。我想不出来,在网上也找不到任何帮助 我将消息推送到ActiveMQ的配置如下- @Bean public IntegrationFlow toActiveMQFlow( MessageChannel channel, Act
@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
谢谢你的帮助 您需要使用
Jms.messageDrivenChannelAdapter(ConnectionFactory ConnectionFactory)
而且不要使用spring集成java dsl
。自版本5.0以来,它被合并到核心项目中:
我们已经用类路径上的一个旧JavaDSLJAR解决了这个问题:TibcoeMConnectionFactory是否也与JMS有关?Jms.messageDrivenChannelAdapter()
对您不起作用吗?顺便说一句,您的XML是怎么回事?我尝试了Jms.inboudAdapter和Jms.messageDrivenChannelAdapter,但不断收到此编译错误-无法从(org.springframework.integration.dsl.jms.JmsMessageDrivenChannelAdapterSpec.JmsMessageDrivenChannelAdapterListenerContainerSpec)“
我正在使用spring integration core 5.0.7.RELEASE和spring integration java dsl 1.2.2.RELEASE从版本spring integration开始5.0
您不应该在java dsl中使用额外的工件。它现在包含在核心项目中。请参阅:此项目已被spring integration core从版本5开始吸收。0.
谢谢@ArtemBilan,在删除spring集成java dsl
工件后,我能够配置至少连接到Tibco EMS。我用TibjmsConnectionFactory
和TibjmsTopic
创建了一个DefaultMessageListenerContainer
,并将其传递给Jms.messageDrivenChannelAdapter
。但现在在应用程序启动后,我在日志中不断收到此错误消息-o.s.j.l.DefaultMessageListenerContainer:为目标主题[Tibcotic]设置JMS消息侦听器调用程序失败“-正在尝试恢复。原因:不允许
。原因:不允许
是Tibco特有的,我想已经超出了Spring集成范围。与我的Tibco管理员进行了检查,发现他们不允许我们创建持久订户,因此出现了“不允许”错误。我现在必须使用JNDI来完成这项工作。感谢@ArtemBilan提供的输入。