// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
[id="extensions-file-cluster-service"]
= File Cluster Service
:linkattrs:
:cq-artifact-id: camel-quarkus-file-cluster-service
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Provides a FileLock implementation of the Camel Cluster Service SPI
:cq-deprecated: false
:cq-jvm-since: 3.10.0
:cq-native-since: 3.10.0

ifeval::[{doc-show-badges} == true]
[.badges]
[.badge-key]##JVM since##[.badge-supported]##3.10.0## [.badge-key]##Native since##[.badge-supported]##3.10.0##
endif::[]

Provides a FileLock implementation of the Camel Cluster Service SPI

[id="extensions-file-cluster-service-maven-coordinates"]
== Maven coordinates

https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-file-cluster-service[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]

Or add the coordinates to your existing project:

[source,xml]
----
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-file-cluster-service</artifactId>
</dependency>
----
ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]

[id="extensions-file-cluster-service-additional-camel-quarkus-configuration"]
== Additional Camel Quarkus configuration

[id="extensions-file-cluster-service-configuration-having-only-a-single-consumer-in-a-cluster-consuming-from-a-given-endpoint"]
=== 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 xref:reference/extensions/master.adoc[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:

[source,java]
----
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`:

[source,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.


[width="100%",cols="80,5,15",options="header"]
|===
| Configuration property | Type | Default


a|icon:lock[title=Fixed at build time] [[quarkus-camel-cluster-file-enabled]]`link:#quarkus-camel-cluster-file-enabled[quarkus.camel.cluster.file.enabled]`

Whether a File Lock Cluster Service should be automatically configured according to
'quarkus.camel.cluster.file.++*++' configurations.
| `boolean`
| `true`

a|icon:lock[title=Fixed at build time] [[quarkus-camel-cluster-file-id]]`link:#quarkus-camel-cluster-file-id[quarkus.camel.cluster.file.id]`

The cluster service ID (defaults to null).
| `string`
| 

a|icon:lock[title=Fixed at build time] [[quarkus-camel-cluster-file-root]]`link:#quarkus-camel-cluster-file-root[quarkus.camel.cluster.file.root]`

The root path (defaults to null).
| `string`
| 

a|icon:lock[title=Fixed at build time] [[quarkus-camel-cluster-file-order]]`link:#quarkus-camel-cluster-file-order[quarkus.camel.cluster.file.order]`

The service lookup order/priority (defaults to 2147482647).
| `int`
| 

a|icon:lock[title=Fixed at build time] [[quarkus-camel-cluster-file-attributes-attributes]]`link:#quarkus-camel-cluster-file-attributes-attributes[quarkus.camel.cluster.file.attributes."attributes"]`

The custom attributes associated to the service (defaults to empty map).
| `Map<String,String>`
| 

a|icon:lock[title=Fixed at build time] [[quarkus-camel-cluster-file-acquire-lock-delay]]`link:#quarkus-camel-cluster-file-acquire-lock-delay[quarkus.camel.cluster.file.acquire-lock-delay]`

The time to wait before starting to try to acquire lock (defaults to 1000ms).
| `string`
| 

a|icon:lock[title=Fixed at build time] [[quarkus-camel-cluster-file-acquire-lock-interval]]`link:#quarkus-camel-cluster-file-acquire-lock-interval[quarkus.camel.cluster.file.acquire-lock-interval]`

The time to wait between attempts to try to acquire lock (defaults to 10000ms).
| `string`
| 
|===

[.configuration-legend]
{doc-link-icon-lock}[title=Fixed at build time] Configuration property fixed at build time. All other configuration properties are overridable at runtime.

