1
votes

I have a file inbound adapter wired to an file out bound gateway . Below is the configuration .

*

*

A bunch of files were processed as expected on one instance earlier in the day . Another instance was restarted for some reason ,a few hrs later and it started processing messages that were processed on another instance already .it resulted in a filenotfound exception for each message frm the outbound gateway

2015-02-19 00:46:15,761 [task-scheduler-8] INFO org.springframework.integration.file.FileWritingMessageHandler - Failed to move file '/tcserver/mounts/file_int/source/b31d688bc85c429bb4748f56a38f4e61'. Using copy and delete fallback.

2015-02-19 00:46:15,762 [task-scheduler-8] DEBUG org.springframework.integration.handler.LoggingHandler - (inner bean)#8 received message: [Payload=org.springframework.integration.MessageHandlingException: failed to write Message payload to file][Headers={timestamp=1424328375761, id=ad494ba5-795f-40d0-b523-74998088028e}]

2015-02-19 00:46:15,762 [task-scheduler-8] ERROR org.springframework.integration.handler.LoggingHandler - org.springframework.integration.MessageHandlingException: failed to write Message payload to file at org.springframework.integration.file.FileWritingMessageHandler.handleRequestMessage(FileWritingMessageHandler.java:293) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73) .....

Caused by: java.io.FileNotFoundException: /tcserver/mounts/file_int/source/b31d688bc85c429bb4748f56a38f4e61 (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:146) at org.springframework.util.FileCopyUtils.copy(FileCopyUtils.java:63) at org.springframework.integration.file.FileWritingMessageHandler.handleFileMessage(FileWritingMessageHandler.java:352) at org.springframework.integration.file.FileWritingMessageHandler.handleRequestMessage(FileWritingMessageHandler.java:277)

1)Does spring save the state of the system before a system shutdown in the server . 2) Any explanation on why this could happen could help greatly

1
<int-file:inbound-channel-adapter id="filesIn" directory="file:${files.source.directory}" prevent-duplicates="${prevent.file.duplicates}" filter="textFileFilter"> <int:poller trigger="filePollingTrigger" max-messages-per-poll="${file.polling.size}"/> </int-file:inbound-channel-adapter>Zak
<int-file:outbound-gateway id="filesOut" request-channel="filesIn" reply-channel="processFile" directory="file:${printexpert.files.processed.directory}" auto-create-directory="true" mode="REPLACE" delete-source-files="true" />Zak

1 Answers

0
votes

If you have multiple instances referencing the same source directory you need to use a persistent file list filter, together with a MetadataStore (e.g. Redis) to share state across the instances.

See the documentation.