Questo contenuto non è disponibile nella lingua selezionata.

Chapter 25. File


Read and write files.

25.1. What’s inside

Please refer to the above link for usage and configuration details.

25.2. Maven coordinates

Create a new project with this extension on code.quarkus.redhat.com

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-file</artifactId>
</dependency>
Copy to Clipboard Toggle word wrap

25.3. Additional Camel Quarkus configuration

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");
Copy to Clipboard Toggle word wrap

It’s possible to enable the file cluster service with a property like below:

quarkus.camel.cluster.file.enabled = true
quarkus.camel.cluster.file-root = target/cluster-folder-where-lock-file-will-be-held
Copy to Clipboard Toggle word wrap

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.

Expand
Configuration propertyTypeDefault

lock quarkus.camel.cluster.file.enabled

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

boolean

false

lock quarkus.camel.cluster.file-id

The cluster service ID (defaults to null).

string

 

lock quarkus.camel.cluster.file-root

The root path (defaults to null).

string

 

lock quarkus.camel.cluster.file-order

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

java.lang.Integer

 

lock quarkus.camel.cluster.file.acquire-lock-delay

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

string

 

lock quarkus.camel.cluster.file.acquire-lock-interval

The time to wait between attempts to try to acquire lock (defaults to 10000ms).

string

 

lock quarkus.camel.cluster.file.attributes

The custom attributes associated to the service (defaults to empty map).

Map<String,String>

 

lock Configuration property fixed at build time. All other configuration properties are overridable at runtime.

Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2026 Red Hat