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

	<jdbc:embedded-database id="dataSource" type="H2" />

	<jdbc:initialize-database ignore-failures="DROPS">
		<jdbc:script location="org/springframework/integration/jdbc/schema-drop-h2.sql"/>
		<jdbc:script location="org/springframework/integration/jdbc/schema-h2.sql" />
	</jdbc:initialize-database>

	<int-jdbc:message-store id="messageStore"
		data-source="dataSource" />

	<channel id="relay" xmlns="http://www.springframework.org/schema/integration">
		<queue message-store="messageStore" />
	</channel>

	<channel id="durable" xmlns="http://www.springframework.org/schema/integration">
		<queue message-store="messageStore" />
	</channel>

	<service-activator id="service-relay" input-channel="relay"
		output-channel="durable" xmlns="http://www.springframework.org/schema/integration">
		<beans:bean
			class="org.springframework.integration.jdbc.store.JdbcMessageStoreChannelOnePollerIntegrationTests$Service" />
		<poller fixed-rate="200">
			<advice-chain>
				<ref bean="txAdvice" />
				<ref bean="lock" />
			</advice-chain>
		</poller>
	</service-activator>

	<bean id="lock" class="org.springframework.integration.jdbc.LockInterceptor" />
	<tx:advice id="txAdvice">
		<tx:attributes>
			<tx:method name="*" />
		</tx:attributes>
	</tx:advice>

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

</beans>
