<?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:channel id="replyChannel">
		<int:queue/>
	</int:channel>

	<int:channel id="pingChannel"/>

	<int:channel id="leftPushChannel"/>

	<int:channel id="leftPushRightPopChannel"/>

	<int:channel id="incrementAtomicIntegerChannel"/>

	<int:channel id="getCommandChannel"/>

	<int:channel id="setDelCommandChannel"/>

	<int:channel id="mgetCommandChannel"/>

	<int-redis:outbound-gateway request-channel="pingChannel" reply-channel="replyChannel"
								arguments-strategy=""/>

	<int-redis:outbound-gateway request-channel="leftPushRightPopChannel" reply-channel="replyChannel"
								connection-factory="redisConnectionFactory"
								argument-expressions="headers.queue, #cmd == 'LPUSH' ? payload : null"
								use-command-variable="true"/>

	<int-redis:outbound-gateway request-channel="incrementAtomicIntegerChannel" reply-channel="replyChannel"
								command-expression="payload"
								argument-expressions="'si.test.RedisAtomicInteger'"/>

	<int-redis:outbound-gateway request-channel="setDelCommandChannel" reply-channel="replyChannel"/>

	<int-redis:outbound-gateway request-channel="getCommandChannel" reply-channel="replyChannel"
								command-expression="'GET'"/>

	<int-redis:outbound-gateway request-channel="mgetCommandChannel" reply-channel="replyChannel"
								command-expression="'MGET'"/>

	<bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
		<constructor-arg ref="redisConnectionFactory"/>
	</bean>

	<bean id="atomicInteger" class="org.springframework.data.redis.support.atomic.RedisAtomicInteger" lazy-init="true">
		<constructor-arg value="si.test.RedisAtomicInteger"/>
		<constructor-arg ref="redisConnectionFactory"/>
		<constructor-arg value="10"/>
	</bean>

</beans>
