camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Camel - Move specific exchanges ONLY to a different location
Date Wed, 10 Oct 2012 09:19:16 GMT
On Wed, Oct 10, 2012 at 8:39 AM, raviwithyou <> wrote:
> Hi,
> We had a scenario where we wanted to move only specific files to a different
> location (say done using move=done) and keep the remaining exchanges in the
> same location.
> This is the strategy we used to remove stale files for our application to
> Done location, meanwhile the correct files should remain in the same
> location.
> We tried a lot of approaches, but we couldn't separately move (not copy)
> some files to a different location and retain the rest. The problem we
> realized is because Camel sets the options like rename, move, delete for all
> the exchanges for a given route and not on a specific exchange.
> Finally we created and plugged in a custom ProcessStrategy and replicated
> Camel's GenericFileRenameProcessStrategy code and tweaked a little for our
> exchange based needs. The risk we have here is we will lose track of Camel's
> updates on this code in future.

You are actually doing the correct by using a custom process strategy.

> However I strongly feel, that the options should be controllable on an
> exchange basis too, like lets say setting some property on the
> exchange.setProperty("SKIP_MOVEMENT", true). This will let us to override
> route based movement config on the exchange side.

Sorry we cannot support every single end user requirement by adding
new special headers/properties etc.
The file/ftp components is already a lot of functionality out of the
box. And adding this kinda leads to confusion.

What we may do is to let the move expression leave the file as is, if
the result is null/empty. Then we could skip moving the file.
Then you can just implement a bean and use that to compute the file
name if the file should be moved, or return null/empty if to stay as


<bean id="myMoveBean" class=..."/>

And then you can just have a bean with a method that has the logic.
And you can use the Camel bean parameter bindings etc.

public class MyMoveBeanImpl {

   public static String moveName(@Header("CamelFileName") name) {

> I am willing to contribute the code for Camel.
> Regards,
> Ravi
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Red Hat, Inc.
FuseSource is now part of Red Hat
Twitter: davsclaus
Author of Camel in Action:

View raw message