Reputation: 417
Below is my camel file route with a delay set to 2000, which continuosly polls a folder {{ResponsePath}}
and moves it to path {{ResponseProcessed}}
on completion and to {{ResponseFailed}}
on failure
<route id="fileProcessor">
<from uri="file://{{ResponsePath}}?preMove={{ResponseInProgressPath}}/${header.CamelFileNameOnly}&move={{ResponseProcessed}}/${header.CamelFileNameOnly}&moveFailed={{ResponseFailed}}/${header.CamelFileNameOnly}&delay=2000"/>
<doTry>
<convertBodyTo type="java.lang.String"/>
<log message="Response ${body}"/>
<bean ref="fileProcessorBean" method="processFile" />
<log message="File Processed Successfully"/>
<doCatch>
<exception>com.test.CustomFileException
</exception>
<handled>
<constant>true</constant>
</handled>
</doCatch>
</doTry>
</route>
The problem Im facing is on loading multiple files to the polling folder, some of the files are processed and moved to PROCESSED path and some are directly moved to PROCESSED path without processing
Upvotes: 0
Views: 432
Reputation: 7005
As @Screwtape already commented, all files are moved to PROCESSED path because you catch and handle exceptions.
Remove the whole doTry/doCatch block so that exceptions reach the file consumer and it will move these files to the FAILED path.
Upvotes: 1