Domanda

Whenever I start a Camel route from a file URI, I see that Camel obtains a "lock" on the file. For instance, if the file is named myinput.xml, then Camel creates a "lock file" on it, in the same directory, called myinput.xml.camelLock.

  1. What is this and why does Camel use it?
  2. When does Camel "release" the lock file (delete it)?
  3. Most importantly, is there a way to configure the file URI to not lock at all (and if so, how)?
È stato utile?

Soluzione

Hope this helps you my friend

readLocks is used by consumers, to only poll the files if it has exclusive read-lock on the file (i.e. the file is not in-progress or being written). Camel will wait until the file lock is granted after that Camel creates a marker file and then holds a lock on it camel maintain that lock as JDK IO API cannot always determine whether a file is currently being used by another process. The option readLockCheckInterval can be used to set the check frequency. This option is only avail for the FTP component from Camel 2.8 onwards. Notice that from Camel 2.10.1 onwards the FTP option fastExistsCheck can be enabled to speedup this readLock strategy.

Notice from Camel 2.10 onwards the read locks changed, fileLock and rename will also use a markerFile as well, to ensure not picking up files that may be in process by another Camel consumer running on another node (eg cluster). This is only supported by the file component (not the ftp component).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top