See the red box on the page about pollEnrich - its not dynamic. There is a JIRA ticket to improve this in the future (but its a bit harder due API changes)
You can though use a java bean and use consumer template where you can do dynamic. Or if you dont need to move/delete the file or do any custom aggregation strategy, then its much easier to just do a message transformation and set the body type to java.io.File and the body content as the file name. <transform> <simple resultType="java.io.File">${header.someName}</simple> </transform> On Wed, Nov 27, 2013 at 4:51 AM, Lothar Werzinger <lot...@tradescape.biz> wrote: > pollEnrich looks like it's exactly what I am looking for. > I will try it ASAP. > > Thanks! > > > On Tue, Nov 26, 2013 at 6:09 PM, Henrique Viecili <viec...@gmail.com> wrote: > >> You can use pollEnrich with a file: endpoint. >> >> Henrique Viecili >> >> >> On 27 November 2013 12:10, Bilgin Ibryam <bibr...@gmail.com> wrote: >> >> > Hi Lothar, >> > >> > One possible approach would be to have a processor that receives the >> > notification and creates dynamically a route based on the notification >> > header to poll the directory. >> > >> > Here is some pseudo code: >> > >> > from(jms) >> > .process(new Processor() { >> > @Override >> > public void process(Exchange exchange) throws >> > Exception { >> > >> > exchange.getContext().addRoutes(new RouteBuilder() { >> > >> > public void configure() { >> > >> > from("file://" + header + ? + >> > sendEmptyMessageWhenIdle=true) >> > >> > .to(somewhere) >> > } >> > >> > } >> > }) >> > >> > >> > The route could send an empty message when all the files are processed, >> > allowing you to detect that and stop it as shown here >> > >> > http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html >> > >> > HTH, >> > >> > >> > >> > On Tue, Nov 26, 2013 at 10:39 PM, Lothar Werzinger < >> lot...@tradescape.biz >> > >wrote: >> > >> > > Hi, >> > > >> > > I would like to create a route that responds to a trigger (e.g. from a >> > > queue) and then scans a directory which path is given as a header >> > attribute >> > > in the trigger message where I can then route the found files through a >> > set >> > > of other components. >> > > >> > > However if I connect a file component to an input component it >> > > automatically becomes an output component, so the "direct approach" >> > > from(...).to(file://...).to(...) obviously does not work. >> > > >> > > How can I create such a route? >> > > >> > > Thanks in advance! >> > > -- >> > > >> > > Lothar Werzinger >> > > >> > > Principal Architect >> > > >> > > Tradescape, Inc. - Enabling Efficient Digital Marketplaces >> > > >> > > +1-650-931-6719 (direct) >> > > >> > > +1-800-697-6068 (main) Ext. 116 >> > > >> > > lot...@tradescape.biz >> > > >> > > http://www.tradescape.biz >> > > >> > > -- >> > > >> > > >> > > This message and any attachment (the "message") is intended solely for >> > the >> > > addressees and is confidential. If you receive this message by mistake, >> > > please delete it and notify the sender immediately. Any use not >> > > in accordance with its purpose, any out-spread or disclosure, either >> as a >> > > whole or partially, is prohibited except with formal approval. Internet >> > > cannot guarantee the integrity of this message, therefore Tradescape >> will >> > > not be liable for the message if modified. >> > > >> > > - >> > > >> > >> > >> > >> > -- >> > Bilgin Ibryam >> > >> > Apache Camel & Apache OFBiz committer >> > Blog: ofbizian.com >> > Twitter: @bibryam <https://twitter.com/bibryam> >> > >> > Author of Instant Apache Camel Message Routing >> > http://www.amazon.com/dp/1783283475 >> > >> > > > > -- > > Lothar Werzinger > > Principal Architect > > Tradescape, Inc. - Enabling Efficient Digital Marketplaces > > +1-650-931-6719 (direct) > > +1-800-697-6068 (main) Ext. 116 > > lot...@tradescape.biz > > http://www.tradescape.biz > > -- > > > This message and any attachment (the "message") is intended solely for the > addressees and is confidential. If you receive this message by mistake, > please delete it and notify the sender immediately. Any use not > in accordance with its purpose, any out-spread or disclosure, either as a > whole or partially, is prohibited except with formal approval. Internet > cannot guarantee the integrity of this message, therefore Tradescape will > not be liable for the message if modified. > > - -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen