<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns:jms="http://www.springframework.org/schema/jms"
		xmlns:int="http://www.springframework.org/schema/integration"
		xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
		xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/jms https://www.springframework.org/schema/jms/spring-jms.xsd
		http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
		http://www.springframework.org/schema/integration/jms https://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
		http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">

	<int-jms:outbound-channel-adapter id="channelAdapterChannel" destination-expression="'queue.test.dynamic.adapter.' + headers.destinationNumber"/>

	<int-jms:message-driven-channel-adapter channel="channelAdapterResults1" destination-name="queue.test.dynamic.adapter.1" extract-payload="false"/>

	<int-jms:message-driven-channel-adapter channel="channelAdapterResults2" destination-name="queue.test.dynamic.adapter.2" extract-payload="false"/>

	<int:channel id="gatewayChannel"/>

	<int-jms:outbound-gateway request-channel="gatewayChannel" request-destination-expression="'queue.test.dynamic.gateway.' + headers.destinationNumber"/>

	<int:channel id="channelAdapterResults1">
		<int:queue capacity="1"/>
	</int:channel>

	<int:channel id="channelAdapterResults2">
		<int:queue capacity="1"/>
	</int:channel>

	<util:constant id="jmsConnectionFactory"
				   static-field="org.springframework.integration.jms.ActiveMQMultiContextTests.connectionFactory"/>

	<jms:listener-container connection-factory="jmsConnectionFactory">
		<jms:listener destination="queue.test.dynamic.gateway.1" ref="responder" method="one"/>
		<jms:listener destination="queue.test.dynamic.gateway.2" ref="responder" method="two"/>
	</jms:listener-container>

	<bean id="responder" class="org.springframework.integration.jms.config.JmsDynamicDestinationTests$Responder"/>

</beans>
