问题
I've got a camel route reading from a file and it's not deleting the .CamelLock file after the route finishes so I wanted to turn lock off. The documentation for Camel-File says that the attribute is "lock" yet when I do <from uri="file:///data/in/?lock=false" />
I get:
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: file:///data/in/?lock=false due to: Failed to resolve endpoint: file:///data/in/?lock=false due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{lock=false}]
Camel 2.11.0
回答1:
The file component documentation for Camel 2.x is here: http://camel.apache.org/file2 You most likely read the old Camel 1.x documentation at: http://camel.apache.org/file Notice on the top of the page, it says this is for Camel 1.x!
There is a readLock option which by default uses markerFile (and hence why you see those .camelLock files). You can turn this off by setting the readLock option to none, eg
readLock=none
回答2:
try using ?readLock=false
see https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java
来源:https://stackoverflow.com/questions/18194981/camel-not-recognizing-lock-false-as-valid