You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jmsst <jm...@smartshifttech.com> on 2016/05/20 15:38:33 UTC

File component: Dynamically decide whether a file should be deleted or not

Hello,

I want to decide in the route if the file should be deleted after processing
or not.
My approach to send it to file:${file:path} does not work.
Anyone aware of a solution for this requirement?

Camel version I use: 2.15.1

Best regards
Johannes



--
View this message in context: http://camel.465427.n5.nabble.com/File-component-Dynamically-decide-whether-a-file-should-be-deleted-or-not-tp5782842.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: File component: Dynamically decide whether a file should be deleted or not

Posted by jmsst <jm...@smartshifttech.com>.
Claus Ibsen-2 wrote
> What should happen if you do not want to delete the file? Should it
> stay in the directory or be moved?

It should stay in the directory.

I've done it now the following way:
If I want to not delete the file, I throw an exception and catch the
exception with
onException(FileShouldNotBeDeletedException.class).handled(false).stop();

I don't really like this approach and I don't really like the approach with
another "delete" directory either. But OK this are possible ways. I thought
there might be a way to decide dynamically if delete should be applied or
not even without an exception. But I can't find anything like that.

Regards
Johannes




--
View this message in context: http://camel.465427.n5.nabble.com/File-component-Dynamically-decide-whether-a-file-should-be-deleted-or-not-tp5782842p5783086.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: File component: Dynamically decide whether a file should be deleted or not

Posted by Claus Ibsen <cl...@gmail.com>.
What should happen if you do not want to delete the file? Should it
stay in the directory or be moved?

On Fri, May 20, 2016 at 5:38 PM, jmsst <jm...@smartshifttech.com> wrote:
> Hello,
>
> I want to decide in the route if the file should be deleted after processing
> or not.
> My approach to send it to file:${file:path} does not work.
> Anyone aware of a solution for this requirement?
>
> Camel version I use: 2.15.1
>
> Best regards
> Johannes
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/File-component-Dynamically-decide-whether-a-file-should-be-deleted-or-not-tp5782842.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: File component: Dynamically decide whether a file should be deleted or not

Posted by yogu13 <yo...@gmail.com>.
Hi,

One way i can think of ...One figuring the file needs to be deleted within
the route, then move the files which needs to be deleted to a directory lets
call it /delete. Have another route which keep sensing the delete directory
and deletes them.

Regards,
-Yogesh





--
View this message in context: http://camel.465427.n5.nabble.com/File-component-Dynamically-decide-whether-a-file-should-be-deleted-or-not-tp5782842p5782894.html
Sent from the Camel - Users mailing list archive at Nabble.com.