File Cluster Service
JVM since3.10.0 Native since3.10.0
Provides a FileLock implementation of the Camel Cluster Service SPI
Maven coordinates
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-file-cluster-service</artifactId>
</dependency> Check the User guide for more information about writing Camel Quarkus applications.
Additional Camel Quarkus configuration
Having only a single consumer in a cluster consuming from a given endpoint
When the same route is deployed on multiple JVMs, it could be interesting to use this extension in conjunction with the Master one. In such a setup, a single consumer will be active at a time across the whole camel master namespace.
For instance, having the route below deployed on multiple JVMs:
from("master:ns:timer:test?period=100")
.log("Timer invoked on a single JVM at a time"); It’s possible to configure the file cluster service with a property like below in application.properties:
quarkus.camel.cluster.file.root = target/cluster-folder-where-lock-file-will-be-held As a result, a single consumer will be active across the ns camel master namespace. It means that, at a given time, only a single timer will generate exchanges across all JVMs. In other words, messages will be logged every 100ms on a single JVM at a time.
The file cluster service could further be tuned by tweaking quarkus.camel.cluster.file.* properties.
| Configuration property | Type | Default |
|---|---|---|
The cluster service ID (defaults to null). |
| |
The root path (defaults to null). |
| |
The service lookup order/priority (defaults to 2147482647). |
| |
The custom attributes associated to the service (defaults to empty map). |
| |
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 (defaults to 1000ms). |
| |
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 (defaults to 10000ms). |
| |
Multiplier applied to the cluster leader For example, if the leader updates its heartbeat every 2 seconds and the |
| |
Sets how many times a cluster data task will run, counting both the first execution and subsequent retries in case of failure or timeout. The default is 5 attempts. 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. |
| |
Sets the timeout for a cluster data task (reading or writing cluster data). The default is 10 seconds. Timeouts are useful when the cluster data root is on network storage, where I/O operations may occasionally block for long or unpredictable periods. |
| |
Whether a File Lock Cluster Service should be automatically configured according to 'quarkus.camel.cluster.file.*' configurations. |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.