Trigger causes Poll from ftp server to sftp

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Trigger causes Poll from ftp server to sftp

watcher
This might have a simple solution but I'm struggling to implement it.

My use case consist of having files uploaded to a webserver with a status of 'fileuploaded'.
This file get store onto an internal FTP server.
At some point a user will change the file status to another status e.g. 'process' at which point the file
will get copied from the ftp server to another SFTP server offsite.

I'm publishing a JMS message with the headers filename property set. This filename is the only file I want to copy from ftp to  sftp.

    from ("activemq:queue:test").get("ftp://username@localhost/ftp/" + header("filename"))
    .to("sftp://username@localhost/sftp/")

Can anyone help please?
Reply | Threaded
Open this post in threaded view
|

Re: Trigger causes Poll from ftp server to sftp

Claus Ibsen-2
Hi

I will get to you in a bit. You can use a processor and use some java
code to consume from the FTP endpoint once and then continue the
routing.

We are planning to support your kind of use-case much more easily in Camel 2.x.

You can use the Camel API using the CamelContext to get an endpoint
for the FTP consumer
And then with some Camel java API you can create a consumer, start it
and get the response.
And put the response into the oirginal exchange.

Try a bit and get back. I currently haven't the time to create a sample.




On Wed, Dec 10, 2008 at 1:20 PM, watcher <[hidden email]> wrote:

>
> This might have a simple solution but I'm struggling to implement it.
>
> My use case consist of having files uploaded to a webserver with a status of
> 'fileuploaded'.
> This file get store onto an internal FTP server.
> At some point a user will change the file status to another status e.g.
> 'process' at which point the file
> will get copied from the ftp server to another SFTP server offsite.
>
> I'm publishing a JMS message with the headers filename property set. This
> filename is the only file I want to copy from ftp to  sftp.
>
>    from ("activemq:queue:test").get("ftp://username@localhost/ftp/" +
> header("filename"))
>    .to("sftp://username@localhost/sftp/")
>
> Can anyone help please?
>
> --
> View this message in context: http://www.nabble.com/Trigger-causes-Poll-from-ftp-server-to-sftp-tp20934240s22882p20934240.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/
Reply | Threaded
Open this post in threaded view
|

Re: Trigger causes Poll from ftp server to sftp

Claus Ibsen-2
Hi

I have added a sample based on a unit test at:
http://cwiki.apache.org/confluence/display/CAMEL/FTP

See the section: Consuming a remote FTP server triggered by a route



On Wed, Dec 10, 2008 at 4:59 PM, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> I will get to you in a bit. You can use a processor and use some java
> code to consume from the FTP endpoint once and then continue the
> routing.
>
> We are planning to support your kind of use-case much more easily in Camel 2.x.
>
> You can use the Camel API using the CamelContext to get an endpoint
> for the FTP consumer
> And then with some Camel java API you can create a consumer, start it
> and get the response.
> And put the response into the oirginal exchange.
>
> Try a bit and get back. I currently haven't the time to create a sample.
>
>
>
>
> On Wed, Dec 10, 2008 at 1:20 PM, watcher <[hidden email]> wrote:
>>
>> This might have a simple solution but I'm struggling to implement it.
>>
>> My use case consist of having files uploaded to a webserver with a status of
>> 'fileuploaded'.
>> This file get store onto an internal FTP server.
>> At some point a user will change the file status to another status e.g.
>> 'process' at which point the file
>> will get copied from the ftp server to another SFTP server offsite.
>>
>> I'm publishing a JMS message with the headers filename property set. This
>> filename is the only file I want to copy from ftp to  sftp.
>>
>>    from ("activemq:queue:test").get("ftp://username@localhost/ftp/" +
>> header("filename"))
>>    .to("sftp://username@localhost/sftp/")
>>
>> Can anyone help please?
>>
>> --
>> View this message in context: http://www.nabble.com/Trigger-causes-Poll-from-ftp-server-to-sftp-tp20934240s22882p20934240.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
>
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
>



--

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/
Reply | Threaded
Open this post in threaded view
|

Re: Trigger causes Poll from ftp server to sftp

Claus Ibsen-2
Hi

On my first attempt I got something messed up with this nicer API but
it should work. From a unit test in camel-ftp itself

        PollingConsumer consumer =
context.getEndpoint(ftpUrl).createPollingConsumer();
        consumer.start();
        // 3 sec timeout
        Exchange out = consumer.receive(3000);
        consumer.stop();

This code is much nicer and cleaner. This code should be in the
process where you can then poll the remote server and get the body
response and populate the original exchange so it will use that
payload in the routing that follows.


On Wed, Dec 10, 2008 at 9:26 PM, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> I have added a sample based on a unit test at:
> http://cwiki.apache.org/confluence/display/CAMEL/FTP
>
> See the section: Consuming a remote FTP server triggered by a route
>
>
>
> On Wed, Dec 10, 2008 at 4:59 PM, Claus Ibsen <[hidden email]> wrote:
>> Hi
>>
>> I will get to you in a bit. You can use a processor and use some java
>> code to consume from the FTP endpoint once and then continue the
>> routing.
>>
>> We are planning to support your kind of use-case much more easily in Camel 2.x.
>>
>> You can use the Camel API using the CamelContext to get an endpoint
>> for the FTP consumer
>> And then with some Camel java API you can create a consumer, start it
>> and get the response.
>> And put the response into the oirginal exchange.
>>
>> Try a bit and get back. I currently haven't the time to create a sample.
>>
>>
>>
>>
>> On Wed, Dec 10, 2008 at 1:20 PM, watcher <[hidden email]> wrote:
>>>
>>> This might have a simple solution but I'm struggling to implement it.
>>>
>>> My use case consist of having files uploaded to a webserver with a status of
>>> 'fileuploaded'.
>>> This file get store onto an internal FTP server.
>>> At some point a user will change the file status to another status e.g.
>>> 'process' at which point the file
>>> will get copied from the ftp server to another SFTP server offsite.
>>>
>>> I'm publishing a JMS message with the headers filename property set. This
>>> filename is the only file I want to copy from ftp to  sftp.
>>>
>>>    from ("activemq:queue:test").get("ftp://username@localhost/ftp/" +
>>> header("filename"))
>>>    .to("sftp://username@localhost/sftp/")
>>>
>>> Can anyone help please?
>>>
>>> --
>>> View this message in context: http://www.nabble.com/Trigger-causes-Poll-from-ftp-server-to-sftp-tp20934240s22882p20934240.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>>
>> /Claus Ibsen
>> Apache Camel Committer
>> Blog: http://davsclaus.blogspot.com/
>>
>
>
>
> --
>
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
>



--

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/