On Wed, Oct 10, 2012 at 8:39 AM, raviwithyou <bytes2r...@gmail.com> 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 is. "file:inbox?move=${bean:myMoveBean}" <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: > http://camel.465427.n5.nabble.com/Camel-Move-specific-exchanges-ONLY-to-a-different-location-tp5720833.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen