File Cluster Service

The File Cluster Service starter provides a cluster service implementation using file-based locking for simple clustering scenarios in Camel Spring Boot applications.

This is suitable for single-machine clustering or shared filesystem scenarios.

Maven Dependency

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-file-cluster-service-starter</artifactId>
</dependency>

Configuration Options

The following configuration options are available under the camel.cluster.file prefix:

Option Default Description

enabled

true

Sets if the file cluster service should be enabled or not.

id

Cluster Service ID.

root

The root path.

acquire-lock-delay

The time to wait before starting to try to acquire the cluster lock. Note that if FileLockClusterService determines no cluster members are running or cannot reliably determine the cluster state, the initial delay is computed from the acquireLockInterval.

acquire-lock-interval

The time to wait between attempts to try to acquire the cluster lock evaluated using wall-clock time. All cluster members must use the same value so leadership checks and leader liveness detection remain consistent.

attributes

Custom service attributes.

heartbeat-timeout-multiplier

Multiplier applied to the cluster leader acquireLockInterval to determine how long followers should wait before considering the leader "stale". For example, if the leader updates its heartbeat every 2 seconds and the heartbeatTimeoutMultiplier is 3, followers will tolerate up to 2s * 3 = 6s of silence before declaring the leader unavailable.

cluster-data-task-max-attempts

The number of times a cluster data task will run, counting both the first execution and subsequent retries in case of failure or timeout. This can be useful when the cluster data root is on network based file storage, where I/O operations may occasionally block for long or unpredictable periods.

cluster-data-task-timeout

The timeout for a cluster data task (reading or writing cluster data). Timeouts are useful when the cluster data root is on network storage, where I/O operations may occasionally block for long or unpredictable periods.

order

Service lookup order/priority.

Usage Example

Configure in application.properties:

camel.cluster.file.enabled=true
camel.cluster.file.root=/var/camel/cluster