Ajit Kalyan
Ajit Kalyan

Reputation: 49

How to poll for a file from shared path location(remote machine location) using apache camel

I am new to the Apache Camel. I want to pick a file from remote file location (ie., Shared location path).

Mapped remote machine shared location path as network drive and used file component as below

<camel:route> 
                        <camel:from uri="file:{{config.fileloc}}?fileName={{filename}}.txt"/> 
                        <to uri="activemq:queue:{{activemq.outqueue}}" /> 
</camel:route> 

filename=DataMoveCommand config.fileloc = //Server/FileLoc

Someone please help me on this. Please provide me some examples on camel-JCFIS and purpose of camel-JCFIS

Upvotes: 3

Views: 3306

Answers (1)

Ralf
Ralf

Reputation: 6853

If you run your Camel application on Windows, then you should be able to access a file on a UNC path without additional libraries like jCIFS. However, in Java, instead of prefixing the UNC path with two backslashes, you need to supply four (to escape the respective following backslash). See the file javadoc. So instead of //Server/FileLoc your path should be \\\\Server/FileLoc.

If you run an OS that has no native support for CIFS, or the share does not allow anonymous access, then you need a library like jCIFS that implements it. The Camel JCIFS compoment page has examples on how to use it as a replacement for the file compoment

Upvotes: 6

Related Questions