0x41ndrea
0x41ndrea

Reputation: 385

download specific file with camel and shutdown

Can i download with camel a specific file list from a sftp server and then shutdown the service? I know this should be a common question but i can't figure out how to do it without waiting the context stopping.

In some way, camel can ensure data integrity?

Upvotes: 0

Views: 2550

Answers (3)

Vijay Kumar
Vijay Kumar

Reputation: 991

Did you check this out at the bottom of the Camel FTP page.

Upvotes: 0

Petter Nordlander
Petter Nordlander

Reputation: 22279

I guess you can do something like this using a direct route, pollEnrich and a template

from("direct:grabOneFile")
   .pollEnrich("sftp://somewhere/blah/blah?fileName=foobar");

then from some java code somewhere, just grab a camel template and invoke the "direct:grabOneFile route.

String ret = template.requestBody("direct:grabOneFile","",String.class);

In this case, you don't have to worry about when to shut down the camel context with the chance of having multiple files etc.

Upvotes: 1

techuser soma
techuser soma

Reputation: 4877

Camel ftp component can only poll directories. You can use a combination of maxMessagesPerPoll and fileName, like

from("ftp://.../xyz?maxMessagesPerPoll=x&fileName=y");

Also take a look at this.

This link has examples regarding shutdown.

Upvotes: 0

Related Questions