<?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:int="http://www.springframework.org/schema/integration"
	xmlns:jdbc="http://www.springframework.org/schema/jdbc"
	xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
	xsi:schemaLocation="http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc.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
	http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">

	<jdbc:embedded-database id="dataSource" type="H2">
		<jdbc:script location="classpath:h2-stored-procedures.sql"/>
	</jdbc:embedded-database>

	<int-jdbc:stored-proc-inbound-channel-adapter id="inbound-adapter" channel="outputChannel" data-source="dataSource"
			ignore-column-meta-data="true"
			expect-single-result="true"
			stored-procedure-name="GET_PRIME_NUMBERS">
		<int-jdbc:sql-parameter-definition name="beginRange" direction="IN" type="INTEGER"/>
		<int-jdbc:sql-parameter-definition name="endRange"   direction="IN" type="INTEGER"/>
		<int-jdbc:parameter name="beginRange" value="1"  type="java.lang.Integer"/>
		<int-jdbc:parameter name="endRange"   value="10" type="java.lang.Integer"/>
		<int-jdbc:returning-resultset name="out" row-mapper="org.springframework.integration.jdbc.storedproc.PrimeMapper"/>
	</int-jdbc:stored-proc-inbound-channel-adapter>

	<int:poller id="defaultPoller" default="true" fixed-rate="5000"/>

	<int:channel id="outputChannel"/>

	<int:service-activator id="consumerEndpoint" input-channel="outputChannel" ref="consumer" />

	<bean id="consumer" class="org.springframework.integration.jdbc.StoredProcPollingChannelAdapterWithNamespaceIntegrationTests$Consumer"/>

	<int:logging-channel-adapter channel="errorChannel" log-full-message="true"/>

	<bean id="transactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>

</beans>
