File Cluster Service

Spring Boot auto-configuration for the Camel File Lock Cluster Service.

This starter provides leader election for Camel routes using file locks on a shared filesystem. It integrates with Camel’s CamelClusterService SPI and the clustered route controller to ensure only one instance of a route runs at a time across multiple JVMs sharing the same filesystem.

Maven coordinates

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

Usage

To use this cluster service, enable the clustered route controller and configure routes with routePolicy=ClusteredRoutePolicy:

# enable the cluster service
camel.cluster.file.enabled = true

# enable the clustered route controller
camel.clustered.controller.enabled = true

Spring Boot Auto-Configuration

The starter supports 10 options, which are listed below.

Name Description Default Type

camel.cluster.file.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.

String

camel.cluster.file.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.

String

camel.cluster.file.attributes

Custom service attributes.

Object>

camel.cluster.file.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. <p> 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.

Integer

camel.cluster.file.cluster-data-task-timeout

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

Long

camel.cluster.file.enabled

Sets if the file cluster service should be enabled or not, default is true.

true

Boolean

camel.cluster.file.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.

Integer

camel.cluster.file.id

Cluster Service ID

String

camel.cluster.file.order

Service lookup order/priority.

Integer

camel.cluster.file.root

The root path.

String