我有一个Spring Integration应用程序和多个配置文件,每个配置文件连接到一个JMS队列。所有队列都将消息发送到单个通道[requestChannel],我已将这些常用信息保存在common.xml文件中。Spring与多个配置文件集成
当我向JMS队列发送消息时,只有一个队列正在发送消息requestChannel,其余队列没有将消息发送到目标[requestChannel]。
有人可以建议我做错了什么。
我可以在两个不同的文件中使用相同的varibale名称并在一个主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>
嗨能否请您详细阐述了如何创建与春季父子关系多配置文件。 –