<?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-file="http://www.springframework.org/schema/integration/file"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:int-aws="http://www.springframework.org/schema/integration/aws"
	xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
		http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/integration/aws http://www.springframework.org/schema/integration/aws/spring-integration-aws.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

	<context:property-placeholder />

	<bean id="credentials" class="org.springframework.integration.aws.core.BasicAWSCredentials">
		<property name="accessKey" value="${accessKey}"/>
		<property name="secretKey" value="${secretKey}"/>
	</bean>

	<int:channel id="s3channel">
		<int:interceptors>
			<int:wire-tap channel="loggit"/>
		</int:interceptors>
	</int:channel>

	<int:logging-channel-adapter id="loggit" level="INFO"
		logger-name="org.springframework.integration.samples.aws.s3"
		expression="'File Name: ' + payload.name + '(' + payload.length() + ')'"/>

	<beans profile="poll-s3">
		<int-aws:s3-inbound-channel-adapter credentials-ref="credentials" local-directory="s3-local-storage"
			temporary-suffix=".transferring"
			bucket="${bucket}" channel="s3channel" remote-directory="${remoteDirectory}"/>
		<int-file:outbound-channel-adapter channel="s3channel" directory="target/s3-out"/>

		<int:poller default="true" fixed-rate="5000"/>

	</beans>
	<beans profile="upload-to-s3">
		<int-aws:s3-outbound-channel-adapter credentials-ref="credentials"
			bucket="${bucket}" channel="s3channel" remote-directory="${remoteDirectory}"/>
	</beans>
</beans>
