下面是我的camel文件路径,延迟设置为2000,它连续轮询文件夹{{ResponsePath}}
,并在完成时将其移动到路径{{ResponseProcessed}}
,失败时移动到{{ResponseFailed}}
<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>
我面临的问题是将多个文件加载到polling文件夹,其中一些文件被处理并移动到已处理路径,而另一些文件则直接移动到已处理路径
发布于 2019-08-30 10:44:34
因为@Screwtape已经注释过了,所有的文件都会被移到PROCESSED,因为你可以捕获和处理异常。
删除整个doTry/doCatch块,以便异常到达文件使用者,并将这些文件移动到失败的路径。
https://stackoverflow.com/questions/57709860
复制相似问题