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

	<bean id="redisConnectionFactory" class="org.mockito.Mockito" factory-method="mock">
		<constructor-arg value="org.springframework.data.redis.connection.RedisConnectionFactory" type="java.lang.Class"/>
	</bean>

	<bean id="customRedisConnectionFactory" parent="redisConnectionFactory"/>

	<int-redis:queue-inbound-channel-adapter id="defaultAdapter" queue="si.test.Int3017.Inbound1"/>

	<int:channel id="sendChannel"/>

	<int-redis:queue-inbound-channel-adapter id="customAdapter"
											 queue="si.test.Int3017.Inbound2"
											 channel="sendChannel"
											 connection-factory="customRedisConnectionFactory"
											 expect-message="true"
											 serializer="serializer"
											 error-channel="errorChannel"
											 receive-timeout="2000"
											 recovery-interval="3000"
											 task-executor="executor"
											 auto-startup="false"
											 phase="100"
											 right-pop="false"/>

	<int-redis:queue-inbound-channel-adapter id="zeroReceiveTimeoutAdapter"
											 queue="si.test.Int3017.Inbound2"
											 channel="sendChannel"
											 connection-factory="customRedisConnectionFactory"
											 receive-timeout="0"/>

	<bean id="executor" class="org.springframework.integration.util.ErrorHandlingTaskExecutor">
		<constructor-arg ref="threadPoolTaskExecutor"/>
		<constructor-arg
				value="#{T(org.springframework.scheduling.support.TaskUtils).LOG_AND_SUPPRESS_ERROR_HANDLER}"/>
	</bean>

	<task:executor id="threadPoolTaskExecutor" pool-size="5"/>

	<bean id="serializer" class="org.springframework.data.redis.serializer.StringRedisSerializer"/>

</beans>
