Service activaor behaving erratically
Hi Guys,
I am trying to copy files from the landing directory to a destination directory via inbound/outbound channel adapters. In the process I am using two service activators, one for the movement between inbound and outbound channel and the second one for delegating from the outbound channel to a seperate class that is meant inform about the completion of the copy and trigger further processing on the file.
The problem is that the second activator is picking up files that has not moved from source to destination and triggering further processing thus resulting in exception.
Not sure if I am doing anything wrong in the wiring, any help would be highly appreciated
configuration file:
Code:
<?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:integration="http://www.springframework.org/schema/integration"
xmlns:file="http://www.springframework.org/schema/integration/file"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/integration/file
http://www.springframework.org/schema/integration/file/spring-integration-file-2.2.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-2.2.xsd">
<file:inbound-channel-adapter id="filesIn" directory="file:C:/test/tmpInbound" scanner="myscanner">
<integration:poller id="poller" fixed-delay="1000" />
</file:inbound-channel-adapter>
<integration:service-activator input-channel="filesIn" output-channel="filesOut" ref="handler" />
<file:outbound-channel-adapter id="filesOut" directory="file:C:/test/DR" delete-source-files="false" filename-generator="writer"/>
<integration:service-activator input-channel="filesOut" ref="complete"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
<bean id="myscanner" class="org.springframework.integration.file.RecursiveLeafOnlyDirectoryScanner" />
<bean id="handler" class="com.watcher.Handler" />
<bean id="writer" class="com.watcher.Writer" />
<bean id="complete" class="com.watcher.Complete" />
</beans>
The output:
Code:
************start***************
generateFileName(C:\test\tmpInbound\Bitmap Image0.bmp)
{timestamp=1358314500737, id=575d8e7d-a959-4b8a-b5b6-19689588319c}
Bitmap Image0.bmp
Original ---> C:\test\tmpInbound\Bitmap Image0.bmp
Final --> \Bitmap Image0.bmp0.13921170863669796
*************done***************
Jan 16, 2013 12:35:01 AM org.springframework.integration.file.FileReadingMessageSource receive
INFO: Created message: [[Payload=C:\test\tmpInbound\Bitmap Image1.bmp][Headers={timestamp=1358314501783, id=6f807524-33a1-4ed5-8e86-907c9a63f6e2}]]
[COMPLETE] C:\test\tmpInbound\Bitmap Image1.bmp
Jan 16, 2013 12:35:02 AM org.springframework.integration.file.FileReadingMessageSource receive
INFO: Created message: [[Payload=C:\test\tmpInbound\Bitmap Image2.bmp][Headers={timestamp=1358314502799, id=33a7932c-0d2a-444f-bf5a-a85f0bfac6f7}]]
************start***************
generateFileName(C:\test\tmpInbound\Bitmap Image2.bmp)
{timestamp=1358314502799, id=8a2695bf-0b86-4cfa-9d22-f97e110258c0}
Bitmap Image2.bmp
Original ---> C:\test\tmpInbound\Bitmap Image2.bmp
Final --> \Bitmap Image2.bmp0.19998457677029258
*************done***************
As you can see in the result above Bitmap Image1.bmp is being picked up by the second activator eventhough the file has not been moved and also the activator is not all being called for the remaining two files that have been moved.
Thanks in advance
Anirban