With camel 2.13.1, I'm trying to use the file component to transfer files
over a network. Using the below camel-context.xml, i'm 90% of the time
getting the "Cannot delete file." I can't find a reason why it rarely
works. Looking at the camel source code, since I'm converting it to a
byte[], it should be able to automatically close the file handle, but its
not.
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
delete file: GenericFile[c:\temp\a\somefile.txt]
at
org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy.commit(GenericFileDeleteProcessStrategy.java:89)
at
org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:124)
<?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:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<camel:camelContext id="camel" typeConverterStatisticsEnabled="true">
<camel:route id="sender">
<camel:from
uri="file://c:\\temp\\a?recursive=true&delete=true&readLock=changed"/>
<camel:pipeline>
<camel:convertBodyTo type="byte[]"/>
<camel:to
uri="netty:tcp://localhost:34444?ssl=true&needClientAuth=true&transferExchange=true&sslContextParameters=#ssl&workerCount=2&sync=true"/>
<camel:log message="moved file ${file:name} of size
${file:size}"/>
</camel:pipeline>
</camel:route>
<camel:route id="receiver">
<camel:from
uri="netty:tcp://localhost:34444?ssl=true&needClientAuth=true&transferExchange=true&sslContextParameters=#ssl&workerCount=2&sync=true"/>
<camel:pipeline>
<camel:to uri="file://c:\\temp\\b"/>
<camel:log message="received file ${file:name} of size
${file:size}"/>
</camel:pipeline>
</camel:route>
</camel:camelContext>
<camel:sslContextParameters id="ssl">
<camel:keyManagers keyPassword="changeit">
<camel:keyStore resource="file:keystore.jks" type="JKS"
password="changeit"/>
</camel:keyManagers>
<camel:trustManagers>
<camel:keyStore resource="file:truststore.jks" type="JKS"
password="changeit"/>
</camel:trustManagers>
<camel:secureSocketProtocols>
<camel:secureSocketProtocol>TLSv1.2</camel:secureSocketProtocol>
</camel:secureSocketProtocols>
</camel:sslContextParameters>
</beans>
--
Curtis Ruck
Anytime: 210-857-1126