<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration/jdbc" xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:si="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	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/integration/jdbc
			https://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">

	<si:channel id="output">
		<si:queue />
	</si:channel>

	<si:channel id="replyChannel">
		<si:queue />
	</si:channel>

	<outbound-gateway id="jdbcGateway" query="select * from foos where id=:headers[id]" update="insert into foos (id, status, name) values (:headers[id], 0, :payload[foo])"
		request-channel="target" reply-channel="output" data-source="dataSource" order="23">
		<request-handler-advice-chain>
			<beans:bean class="org.springframework.integration.jdbc.config.JdbcOutboundGatewayParserTests$FooAdvice" />
		</request-handler-advice-chain>
	</outbound-gateway>

	<si:chain input-channel="jdbcOutboundGatewayInsideChain" output-channel="replyChannel">
		<outbound-gateway id="jdbc-outbound-gateway-within-chain" query="select * from foos where id=:headers[id]"
						  update="insert into foos (id, status, name) values (:headers[id], 0, :payload[foo])"
						  max-rows="2"
						  data-source="dataSource" requires-reply="false"/>

	</si:chain>

	<beans:import resource="jdbcOutboundChannelAdapterCommonConfig.xml" />

</beans:beans>
