<p>I am using apache camel as integration framework in my microservice. I am deploying it in a Kubernetes cloud as multiple pods. I had written a route for reading file from a directory and write to another. But I am facing an issue as the different pods are picking same file. I need to avoid that. I only want any of the pod to pick the file and process but currently all the pods are picking and processing the file. Can someone help with this. Please suggest some examples available in GitHub or any other.
Thanks in advance.</p>

Abhi
<p>Camel recently introduced some interesting clustering capabilities - see <a href="https://camel.apache.org/manual/latest/clustering.html" rel="nofollow noreferrer">here</a>.</p>
<p>In your particular case, you could model a route which is <strong>taking the leadership</strong> when starting the directory polling, preventing thereby other nodes from picking the (same or other) files.</p>
<blockquote>
<p>Set it up is very easy and all you need is to prefix singleton
endpoints according to the master component syntax:
<strong>master:namespace:delegateUri</strong></p>
</blockquote>
<p>This would result in something like this:</p>
<pre><code>from(&quot;master:mycluster:file://...&quot;)
        .routeId(&quot;clustered-route&quot;)
        .log(&quot;Clustered file polling !&quot;);  
</code></pre>
