You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ishada <ab...@gmail.com> on 2015/11/20 09:58:23 UTC

Stop the route when there is no file on the SFTP component

 0
down vote
favorite
	

I am trying to zip all the files on the SFTP endpoint and move it to some
other location. It is working fine but if there are no files on the SFTP
endpoint I need to stop the route. There is an option
sendEmptyMessageWhenIdle on file endpoint to handle such scenario. Is there
a way I can implement this scenario?




--
View this message in context: http://camel.465427.n5.nabble.com/Stop-the-route-when-there-is-no-file-on-the-SFTP-component-tp5774141.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Stop the route when there is no file on the SFTP component

Posted by Claus Ibsen <cl...@gmail.com>.
We could also add a route policy out of the box that checks for those
empty messages and then auto stop a route.
http://camel.apache.org/routepolicy

There is a number of people asking how to stop a route from a route,
or when to stop when there is no more data etc.
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

On Fri, Nov 20, 2015 at 10:29 AM, Siano, Stephan <st...@sap.com> wrote:
> Hi,
>
> The file (and ftp) component has an option sendEmptyMessageWhenIdly.
>
> You could do the following: have one route that consumes from the FTP server (with sendEmptyMessagesWhenIdle set to true). From there send the messages (via direct) to another route. That route checks for empty message bodies and if an empty message body is found it stops the first route with the controlbus endpoint.
>
> Best regards
> Stephan
>
> -----Original Message-----
> From: Ishada [mailto:abhisheksinghbeit@gmail.com]
> Sent: Freitag, 20. November 2015 10:20
> To: users@camel.apache.org
> Subject: RE: Stop the route when there is no file on the SFTP component
>
> I need to stop the route if there are no files on the endpoint.
> My sequence of steps are as follows
> 1> Get Payload form JMS Queue.
> 2>Delete and zip all the files on the SFTP server.
> 3>Move the payload to the SFTP.
>
> So in the 2nd step I am acquiring lock and once the files are deleted, I am
> moving to the 3rd step.
> But If there are no files on the SFTP server to delete, I am not able to
> stop the route and move to the 3rd step.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Stop-the-route-when-there-is-no-file-on-the-SFTP-component-tp5774141p5774144.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

RE: Stop the route when there is no file on the SFTP component

Posted by "Siano, Stephan" <st...@sap.com>.
Hi,

The file (and ftp) component has an option sendEmptyMessageWhenIdly.

You could do the following: have one route that consumes from the FTP server (with sendEmptyMessagesWhenIdle set to true). From there send the messages (via direct) to another route. That route checks for empty message bodies and if an empty message body is found it stops the first route with the controlbus endpoint.

Best regards
Stephan

-----Original Message-----
From: Ishada [mailto:abhisheksinghbeit@gmail.com] 
Sent: Freitag, 20. November 2015 10:20
To: users@camel.apache.org
Subject: RE: Stop the route when there is no file on the SFTP component

I need to stop the route if there are no files on the endpoint.
My sequence of steps are as follows
1> Get Payload form JMS Queue.
2>Delete and zip all the files on the SFTP server.
3>Move the payload to the SFTP.

So in the 2nd step I am acquiring lock and once the files are deleted, I am
moving to the 3rd step.
But If there are no files on the SFTP server to delete, I am not able to
stop the route and move to the 3rd step.



--
View this message in context: http://camel.465427.n5.nabble.com/Stop-the-route-when-there-is-no-file-on-the-SFTP-component-tp5774141p5774144.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Stop the route when there is no file on the SFTP component

Posted by Ishada <ab...@gmail.com>.
I need to stop the route if there are no files on the endpoint.
My sequence of steps are as follows
1> Get Payload form JMS Queue.
2>Delete and zip all the files on the SFTP server.
3>Move the payload to the SFTP.

So in the 2nd step I am acquiring lock and once the files are deleted, I am
moving to the 3rd step.
But If there are no files on the SFTP server to delete, I am not able to
stop the route and move to the 3rd step.



--
View this message in context: http://camel.465427.n5.nabble.com/Stop-the-route-when-there-is-no-file-on-the-SFTP-component-tp5774141p5774144.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Stop the route when there is no file on the SFTP component

Posted by "Siano, Stephan" <st...@sap.com>.
Hi,

Do you want to stop the route or do you want to stop the aggregation into a zip file?

If you really want to stop the route, you can do that with the controlbus component.

http://camel.apache.org/controlbus-component.html 

If you just want to aggregate files into a zipfile till you have consumed everything, you might have a look into the examples for the camel-zipfile data format.

http://camel.apache.org/zip-file-dataformat.html 

Best regards
Stephan

-----Original Message-----
From: Ishada [mailto:abhisheksinghbeit@gmail.com] 
Sent: Freitag, 20. November 2015 09:58
To: users@camel.apache.org
Subject: Stop the route when there is no file on the SFTP component

 0
down vote
favorite
	

I am trying to zip all the files on the SFTP endpoint and move it to some
other location. It is working fine but if there are no files on the SFTP
endpoint I need to stop the route. There is an option
sendEmptyMessageWhenIdle on file endpoint to handle such scenario. Is there
a way I can implement this scenario?




--
View this message in context: http://camel.465427.n5.nabble.com/Stop-the-route-when-there-is-no-file-on-the-SFTP-component-tp5774141.html
Sent from the Camel - Users mailing list archive at Nabble.com.