<?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:si="http://www.springframework.org/schema/integration"
	xmlns:jms="http://www.springframework.org/schema/integration/jms"
	xmlns:task="http://www.springframework.org/schema/task"
	xmlns:context="http://www.springframework.org/schema/context"
	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/integration
			https://www.springframework.org/schema/integration/spring-integration.xsd
			http://www.springframework.org/schema/task
			https://www.springframework.org/schema/task/spring-task.xsd
			http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd
			http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd
			http://www.springframework.org/schema/integration/jms
			https://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">

	<context:property-placeholder properties-ref="props"/>

	<util:properties id="props">
		<prop key="jmsAcknowledgeModeTransacted">transacted</prop>
		<prop key="jmsAcknowledgeModeDupsOk">dups-ok</prop>
 	</util:properties>

	<si:channel id="requestChannel"/>

	<jms:outbound-gateway id="jmsGateway"
						  request-destination-name="requestQueue"
						  request-channel="requestChannel"
						  delivery-persistent="true"
						  idle-reply-listener-timeout="1234"
						  async="true"
						  correlation-key="JMSCorrelationID"
						  auto-startup="false">
		<jms:reply-listener
			acknowledge="${jmsAcknowledgeModeTransacted}"
			concurrent-consumers="4"
			max-concurrent-consumers="5"
			max-messages-per-task="10"
			receive-timeout="2000"
			recovery-interval="10000"
			idle-consumer-limit="7"
			idle-task-execution-limit="2"
			task-executor="exec"
			cache-level="3" />
	</jms:outbound-gateway>

	<task:executor id="exec" />

	<bean id="jmsConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
		<constructor-arg>
			<bean class="org.springframework.integration.jms.StubConnection">
				<constructor-arg value="message-driven-test"/>
			</bean>
		</constructor-arg>
	</bean>

	<jms:outbound-gateway id="advised"
		request-destination-name="requestQueue"
		request-channel="requestChannel"
		delivery-persistent="true"
		auto-startup="false"
		requires-reply="false">
		<jms:request-handler-advice-chain>
			<bean class="org.springframework.integration.jms.config.JmsOutboundGatewayParserTests$FooAdvice" />
		</jms:request-handler-advice-chain>
		<jms:reply-listener
			acknowledge="${jmsAcknowledgeModeDupsOk}"
			concurrent-consumers="3"
			max-concurrent-consumers="5"
			max-messages-per-task="10"
			receive-timeout="2000"
			recovery-interval="10000"
			idle-consumer-limit="1"
			idle-task-execution-limit="2"
			cache-level="3" />
	</jms:outbound-gateway>

</beans>
