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

Reply via email to