Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Apache Camel's File "camelLock"?

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)?
like image 764
AdjustingForInflation Avatar asked Jan 31 '14 17:01

AdjustingForInflation


People also ask

What is camel processor?

The Processor is used for processing message Exchanges. The processor is a core Camel concept that represents a node capable of using, creating, or modifying an incoming exchange.

What is Apache Camel tutorial?

Apache Camel is an open source framework that provides rule-based routing and mediation engine. Apache Camel essentially provides an implementation of various EIPs. It makes integration easier by providing connectivity to a very large variety of transports and APIs.


1 Answers

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).

like image 70
Girish Avatar answered Oct 17 '22 09:10

Girish