You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sakchakravarthi <aj...@gmail.com> on 2014/06/13 07:29:43 UTC

Camel configuration to pick up file from Shared location and remote file location

HI All
I am new to Camel SOA. Can any one help me in configuring from end point to
pick a file with specific file name from shared file location and also from
remote file location.

Thanks
Ajit



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Camel configuration to pick up file from Shared location and remote file location

Posted by akoufoudakis <ak...@gmail.com>.
It is not the file but the directory on a shared location, in which you get
this file from.
You can map this directory as a map drive.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752337.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Camel configuration to pick up file from Shared location and remote file location

Posted by sakchakravarthi <aj...@gmail.com>.
HI 
Are you saying that file in remote machine should be added as network drive
1st and the i need to use file component to pick up. Is my understanding is
correct.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752322.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by Pontus Ullgren <ul...@gmail.com>.
If you read the documentation there is examples:

from("smb://foo@myserver.example.com/sharename?password=secret&localWorkDirectory=/tmp")
  .to("bean:foo");

Also you can have a look at the unit tests.
https://camel-extra.apache-extras.org.codespot.com/git/components/camel-jcifs/src/test/java/org/apacheextras/camel/component/jcifs/
or
https://camel-extra.apache-extras.org.codespot.com/git/components/camel-jcifs/src/integrationtest/java/org/apacheextras/camel/component/jcifs/

// Pontus

On Mon, Jun 16, 2014 at 10:52 AM, sakchakravarthi
<aj...@gmail.com> wrote:
> Hi Pontus
>
> Thanks for your resp. I used forward slash also. but it didnt work for me.
> Can you share any examples on camel-jcifs. I couldn't get any.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752331.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by sakchakravarthi <aj...@gmail.com>.
Hi Pontus

Thanks for your resp. I used forward slash also. but it didnt work for me.
Can you share any examples on camel-jcifs. I couldn't get any.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752331.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by Walid <wa...@gmail.com>.
It seem to be a component issue when trying to catch files from a shared 
folder (shared windows folder on a remote machine)
Local files (from local folders) are correctly consumed



Re: Camel configuration to pick up file from Shared location and remote file location

Posted by Pontus Ullgren <ul...@gmail.com>.
Hello,

I have in the past successfully used the file component to access a remote
windows share. However when doing so the share will be accessed by the user
that the camel process is running as. So that user needs permission to read
and write on the share. Also it only works when running the camel process
on another windows machinen.

Since the company I work for favour Linux based servers we created
camel-jcifs.

So it depends on your use case if you require camel-jcifs or not.

//Pontus
Den 17 jun 2014 07:57 skrev "sakchakravarthi" <
ajit.kalyan.chakravarthi@gmail.com>:

> HI akoufoudakis/Pontus
> As I mentioned file was picked up from a shared folder which is present in
> my local machine. But same
> file:////server/sharefiletest?fileName={{filename}}.txt is  not working
> when
> server is a remote machine.
>
> Are u saying that in that case I need to use jcifs component right.
>
> Thanks
> Ajit
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752399.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by sakchakravarthi <aj...@gmail.com>.
HI akoufoudakis/Pontus 
As I mentioned file was picked up from a shared folder which is present in
my local machine. But same
file:////server/sharefiletest?fileName={{filename}}.txt is  not working when
server is a remote machine.

Are u saying that in that case I need to use jcifs component right.

Thanks
Ajit



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752399.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by Pontus Ullgren <ul...@gmail.com>.
As akoufoudakis say the jcifs component behaves like the File2 or FTP component.
You can see some examples in the docs and also the test source code I
send links to earlier.

If you have questions about camel-jcifs please use the camel-extras
mailing list (http://camel-extra.1091541.n5.nabble.com/)

// Pontus

On Mon, Jun 16, 2014 at 5:43 PM, akoufoudakis <ak...@gmail.com> wrote:
> Glad that it works.
> As for JCIFS, I've never used it so far.
>
> So, I am not a big helper with specifically this component, unfortunately.
> However, you can start reading some docs about
> it:http://camel.apache.org/jcifs.html.
> They say, that it is an extension of the File2 component, so most probably,
> you will just have to change in you route:
> ("from:file...")
>
> to the following:
> ("smb://username@server.com/...?password=...")...
>
> May be, you won't need password in certain cases.
> Since it is an extension of File2, then you will be able to use all other
> parameters (noop, move, delete, etc.).
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752366.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by akoufoudakis <ak...@gmail.com>.
Glad that it works.
As for JCIFS, I've never used it so far.

So, I am not a big helper with specifically this component, unfortunately.
However, you can start reading some docs about
it:http://camel.apache.org/jcifs.html.
They say, that it is an extension of the File2 component, so most probably,
you will just have to change in you route:
("from:file...")

to the following: 
("smb://username@server.com/...?password=...")... 

May be, you won't need password in certain cases.
Since it is an extension of File2, then you will be able to use all other
parameters (noop, move, delete, etc.).



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752366.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by sakchakravarthi <aj...@gmail.com>.
HI 
Thanks akoufoudakis, it worked for me as file:////server/testDst?noop=true.
aslo can you help me con camel-jcifs also how to use it. If possible please
give some example with explanation.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752362.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by akoufoudakis <ak...@gmail.com>.
So, having it like this, you don't have to map anything.
You just have to use server name prefixed by four back slashes (equivalent
to two back slashes, but with proper escape characters).



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752350.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by akoufoudakis <ak...@gmail.com>.
Hey!

I just got a "revelation".
It works fine with the server name.
You would normally open a shared folder something like this:
\\server\folder1\folder2.

So, your route should look like:

from(file:\\\\server\folder1\folder2?...).to("activemq:...");

Check it. I just tried and it worked.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752349.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by akoufoudakis <ak...@gmail.com>.
Hello, Ajit!

We have a shared location, say "\\server\directory".
This location is mapped in our staging machine as a network drive (e. g.,
W:).
Then, I need to get a file from W:\from.
So, my root is from("file:W:\\from").process(...).to("file:...");

May be, it is not a proper way to process files from shared locations, and
may be, indeed, you have to try SMB component, but the scenario, which I
described works.

I also tried to access a file like you, (e.g.:
"file:\\server\directory\from") and the files were not processed also.
I deliberately don't want to use camel extensions, so there were two options
either to set up an FTP or to make a "dirty" trick with a network drive.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752346.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by sakchakravarthi <aj...@gmail.com>.
Hi akoufoudakis
Can you give that example. and config needed if any.

My Scenario is in Server1 folder fileLoc is shared one like
\\Server1\fileLoc then from server2 using camel route I need to fetch file
configFile.txt.

I have tried like 

<camel:route>
                        <camel:from
uri="file://\\Server1\\fileLoc?fileName=configFile.txt"/>
                        <to uri="activemq:queue:{{activemq.outqueue}}" />
</camel:route>

Then When I bringing came context up it showing end point identified as
file://%5CServer1%5CfileLoc?fileName=configFile.txt.

I am not getting why \\ are getting replaced with %5C.

I am using camel core 2.13.0



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752341.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by akoufoudakis <ak...@gmail.com>.
I am using back slashes and it works fine.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752338.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel configuration to pick up file from Shared location and remote file location

Posted by Pontus Ullgren <ul...@gmail.com>.
Hello,

If I remember correctly you should use forward slashes '/' in the path
when using the file component to access a UNC path on a windows
network.
But I could be wrong. I do not have any windows machines available to test.
Also when using the file component camel will access the share as the
user running the camel process.

An alternative is to use the camel-jcifs component from camel-extras
(http://camel.apache.org/jcifs.html) where you can define a different
user.

// Pontus


On Mon, Jun 16, 2014 at 8:53 AM, sakchakravarthi
<aj...@gmail.com> wrote:
> Hi I configured my route as bellow
>
> <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
>
> I mapped shared location \\Remote_Server\\FileLoc as network drive
>  when I bring my camel context up in logs found like as bellow
>
> Route: route18 started and consuming from:
> Endpoint[file://%5CRemote_Server%5CFileLoc?fileName=DataMoveCommand.txt]
>
> Could anyone help me on this.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752326.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Camel configuration to pick up file from Shared location and remote file location

Posted by sakchakravarthi <aj...@gmail.com>.
Hi I configured my route as bellow

<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

I mapped shared location \\Remote_Server\\FileLoc as network drive 
 when I bring my camel context up in logs found like as bellow

Route: route18 started and consuming from:
Endpoint[file://%5CRemote_Server%5CFileLoc?fileName=DataMoveCommand.txt]

Could anyone help me on this.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752326.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Camel configuration to pick up file from Shared location and remote file location

Posted by akoufoudakis <ak...@gmail.com>.
Hello!

For the first scenario, if you want to use the "file" component, you might
want to map your shared location as a network drive and then to use it as
following:
from("file:\\[YOUR_NETWORK_DRIVE]\\[DIR]).to([other_dir]);

To access files on remote servers, I'm afraid you will need to set up FTP.
And, then, to use FTP component of Camel.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752255.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Camel configuration to pick up file from Shared location and remote file location

Posted by sakchakravarthi <aj...@gmail.com>.
I mean Shared folder in another machine with in same network.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752249.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Camel configuration to pick up file from Shared location and remote file location

Posted by akoufoudakis <ak...@gmail.com>.
Hello, Ajit!
Just to clarify.
In the first scenario do you mean a network drive?



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752247.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Camel configuration to pick up file from Shared location and remote file location

Posted by sakchakravarthi <aj...@gmail.com>.
I have two scenarios 

1. Need to access Shared location in remote machine.
2. Need to access file in remote file system (other than FTP)

Thanks
Ravi



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233p5752236.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Camel configuration to pick up file from Shared location and remote file location

Posted by Ra...@cognizant.com.
Ajit

What do you mean by Remote File Location. Is  it on different machine which has to be accessed thru FTP/SFTP ?
Please elaborate.
________________________________________
From: sakchakravarthi [ajit.kalyan.chakravarthi@gmail.com]
Sent: Friday, June 13, 2014 10:59 AM
To: users@camel.apache.org
Subject: Camel configuration to pick up file from Shared location and remote file location

HI All
I am new to Camel SOA. Can any one help me in configuring from end point to
pick a file with specific file name from shared file location and also from
remote file location.

Thanks
Ajit



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-configuration-to-pick-up-file-from-Shared-location-and-remote-file-location-tp5752233.html
Sent from the Camel - Users mailing list archive at Nabble.com.
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.