【发布时间】:2013-10-22 04:50:37
【问题描述】:
我有一个带有多个配置文件的 Spring Integration 应用程序,每个配置文件都连接到一个 JMS 队列。所有队列都将消息发送到单个通道 [requestChannel],我将这些公共信息保存在 common.xml 文件中。
当我向 JMS 队列发送消息时,只有一个队列正在发送消息 requestChannel,其余队列没有向目标 [requestChannel] 发送消息。
有人可以建议我做错了什么。
我可以在 2 个不同的文件中使用相同的变量名称并在一个主 Conext 文件中调用它们吗? [MainApplicationContext.xml],目前我正在做这个。
MainApplicationContext.xml 文件——调用所有其他配置文件。
<beans>
<import resource="common.xml"/>
<import resource="config1.xml"/>
<import resource="config2.xml"/>
<import resource="config3.xml"/>
</beans>
Common.xml -- 有公共频道详情
<bean>
<int:channel id="requestChannel" />
<bean id="testBean" class="com.TestBean" />
<int:chain input-channel="requestChannel">
<int:service-activator ref="testBean" method="processor"/>
</int:chain>
<int:channel id="errorChannel" />
<bean id="epBean" class="com.ErrorProcessorBean" />
<int:chain input-channel="errorChannel">
<int:service-activator ref="epBean" method="processor"/>
</int:chain>
</bean>
config1.xml -- JMS 队列 1
<beans>
<int-jms:message-driven-channel-adapter
id="jmsInputQueueAdaptor_au" channel="requestChannel" connection-factory="cf_au" destination="InputQueueOne"
error-channel="errorChannel" />
<jee:jndi-lookup id="cf_au" jndi-name="jms/ConnectionFactory">
</jee:jndi-lookup>
<jee:jndi-lookup id="InputQueueOne" jndi-name="jms/InputQueueOne">
</jee:jndi-lookup>
</beans>
config2.xml -- JMS 队列 2
<beans>
<int-jms:message-driven-channel-adapter
id="jmsInputQueueAdaptor_au" channel="requestChannel" connection-factory="cf_au" destination="InputQueueOne"
error-channel="errorChannel" />
<jee:jndi-lookup id="cf_au" jndi-name="jms/ConnectionFactory">
</jee:jndi-lookup>
<jee:jndi-lookup id="InputQueueTwo" jndi-name="jms/InputQueueTwo">
</jee:jndi-lookup>
</beans>
【问题讨论】:
标签: spring jms integration