<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:integration="http://www.springframework.org/schema/integration"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
		http://www.springframework.org/schema/integration
																 http://www.springframework.org/schema/integration/spring-integration.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

	<integration:annotation-config />

	<integration:channel id="requests" />
	<integration:channel id="replies" />

	<integration:service-activator ref="testCase" input-channel="requests" output-channel="replies" method="process"/>

	<bean id="delayedTrigger" class="org.springframework.scheduling.support.PeriodicTrigger">
		<constructor-arg value="10"/>
		<property name="initialDelay" value="100"/>
	</bean>

	<integration:inbound-channel-adapter
		ref="testCase" method="input" channel="requests">
		<integration:poller max-messages-per-poll="1" trigger="delayedTrigger">
			<integration:advice-chain>
				<ref bean="txAdvice"/>
				<ref bean="repeatAdvice"/>
			</integration:advice-chain>
		</integration:poller>
	</integration:inbound-channel-adapter>
	<integration:outbound-channel-adapter
		ref="testCase" method="output" channel="replies" />

	<bean id="testCase"
		class="org.springframework.batch.integration.retry.RepeatTransactionalPollingIntegrationTests" />

	<bean id="transactionManager"
		class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />

	<tx:advice id="txAdvice">
		<tx:attributes><tx:method name="*"/></tx:attributes>
	</tx:advice>
	<bean id="repeatAdvice" class="org.springframework.batch.repeat.interceptor.RepeatOperationsInterceptor">
		<property name="repeatOperations">
			<bean class="org.springframework.batch.repeat.support.RepeatTemplate">
				<property name="completionPolicy">
					<bean class="org.springframework.batch.repeat.policy.SimpleCompletionPolicy">
						<property name="chunkSize" value="2" />
					</bean>
				</property>
			</bean>
		</property>
	</bean>
</beans>