I Case
<camel:camelContext id="camel">
<camel:route>
<camel:from ref="hotfolderEndpoint"/>
<camel:to uri="file://c:/test/myfolder/toEnd"></camel:to>
</camel:route>
</camel:camelContext>
<camel:endpoint id="hotfolderEndpoint" camelContextId="camel"
uri="file://c:/test/hotfolder?move=backup/${date:now:yyyyMMdd}/${file:name}"/>
Result:
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot create directory: c:\test\hotfolder\backup\now:yyyyMMdd\name
II Case DSL
from("file://c:/test/myfolder?preMove=inprogress&moveFailed=backup/${date:now:yyyyMMdd}/${file:name}")
.to("file://c:/test/myfolder/toEnd");
Result
preMove works fine (inprogress folder created), but move throws exception:
GenericFileOperationFailedException: Cannot rename file: GenericFile[c:\test\hotfolder\xxx.txt] to: GenericFile[backup\20100512]
III Case
<bean id="hotfolderEndpoint"
class="org.apache.camel.component.file.FileEndpoint"
factory-bean="camel"
factory-method="getEndpoint">
<constructor-arg ref="hotfolder" />
<property name="readLock" value="rename" />
<property name="move" ref="moveExp"/>
</bean>
<bean id="moveExp" class="org.apache.camel.model.language.SimpleExpression">
<property name="expression" value="done/${file:name.noext}-done.${file:ext}"/>
</bean>
Simlar Problem to Case II
IV Case
<camel:camelContext id="camel">
<camel:route>
<camel:from uri="file://c:/test/hotfolder?move=backup/${date:now:yyyyMMdd}/${file:name}"/>
<camel:to uri="file://c:/test/myfolder/toEnd"></camel:to>
</camel:route>
</camel:camelContext>
Result: work as expected
Question: Am I doing sth wrong or there is a bug in Camel