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

	<util:constant id="mongoDbFactory"
				   static-field="org.springframework.integration.mongodb.store.ConfigurableMongoDbMessageGroupStoreTests.MONGO_DATABASE_FACTORY"/>

	<mongo:auditing/>

	<beans:bean id="abstractMessageStore" class="org.springframework.integration.mongodb.store.MongoDbChannelMessageStore"
				abstract="true">
		<beans:constructor-arg name="mongoDbFactory" ref="mongoDbFactory"/>
	</beans:bean>

	<mongo:mapping-converter id="customConverter">
		<mongo:custom-converters>
			<mongo:converter>
				<beans:bean class="org.springframework.integration.mongodb.store.ConfigurableMongoDbMessageGroupStoreTests$MessageReadConverter"/>
			</mongo:converter>
		</mongo:custom-converters>
	</mongo:mapping-converter>

	<beans:bean id="messageStore" parent="abstractMessageStore">
		<beans:constructor-arg name="mappingMongoConverter" ref="customConverter"/>
		<beans:constructor-arg name="collectionName" value="customConverterCollection"/>
		<beans:property name="createIndexes" value="false" />
	</beans:bean>

	<gateway id="gateway"
			 service-interface="org.springframework.integration.mongodb.store.ConfigurableMongoDbMessageGroupStoreTests$TestGateway"
			 default-request-channel="preInputChannel"/>

	<header-enricher input-channel="preInputChannel" output-channel="inputChannel">
		<header-channels-to-string/>
	</header-enricher>

	<channel id="inputChannel">
		<queue message-store="messageStore"/>
	</channel>

	<transformer input-channel="inputChannel" expression="payload.toUpperCase()">
		<poller fixed-delay="1000"/>
	</transformer>

	<poller default="true" fixed-delay="10000"/>

	<beans:bean id="priorityMessageStore" parent="abstractMessageStore">
		<beans:property name="priorityEnabled" value="true"/>
	</beans:bean>

	<channel id="priorityChannel">
		<priority-queue message-store="priorityMessageStore"/>
	</channel>

</beans:beans>
