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

	<bean id="redisConnectionFactory" class="org.springframework.integration.redis.RedisContainerTest"
		  factory-method="connectionFactory"/>

	<int-redis:store-inbound-channel-adapter id="zsetAdapterNoScore"
											 connection-factory="redisConnectionFactory"
											 key-expression="'presidents'"
											 channel="redisChannel"
											 auto-startup="false"
											 collection-type="ZSET">
		<int:poller fixed-rate="100"/>
	</int-redis:store-inbound-channel-adapter>

	<int-redis:store-inbound-channel-adapter id="zsetAdapterWithScoreRange"
											 connection-factory="redisConnectionFactory"
											 key-expression="'presidents'"
											 channel="redisChannel"
											 auto-startup="false"
											 collection-type="ZSET">
		<int:poller fixed-rate="100" max-messages-per-poll="2"/>
	</int-redis:store-inbound-channel-adapter>

	<int-redis:store-inbound-channel-adapter id="zsetAdapterWithSingleScore"
											 connection-factory="redisConnectionFactory"
											 key-expression="'presidents'"
											 channel="redisChannel"
											 auto-startup="false"
											 collection-type="ZSET">
		<int:poller fixed-rate="100"/>
	</int-redis:store-inbound-channel-adapter>

	<int-redis:store-inbound-channel-adapter id="zsetAdapterWithSingleScoreAndSynchronization"
											 connection-factory="redisConnectionFactory"
											 key-expression="'presidents'"
											 channel="transformChannel"
											 auto-startup="false"
											 collection-type="ZSET">
		<int:poller fixed-rate="100">
			<int:transactional synchronization-factory="syncFactory"/>
		</int:poller>
	</int-redis:store-inbound-channel-adapter>

	<int:transaction-synchronization-factory id="syncFactory">
		<int:after-commit expression="payload.removeByScore(18, 18)"/>
	</int:transaction-synchronization-factory>

	<int:channel id="redisChannel">
		<int:queue/>
	</int:channel>

	<int:transformer input-channel="transformChannel" output-channel="otherRedisChannel"
					 expression="payload.rangeByScore(18, 18).size()"/>

	<int:channel id="otherRedisChannel">
		<int:queue/>
	</int:channel>

	<bean id="transactionManager" class="org.springframework.integration.transaction.PseudoTransactionManager"/>

</beans>
