Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C076E10770 for ; Wed, 9 Oct 2013 20:47:18 +0000 (UTC) Received: (qmail 68948 invoked by uid 500); 9 Oct 2013 20:47:18 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 68918 invoked by uid 500); 9 Oct 2013 20:47:18 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 68910 invoked by uid 99); 9 Oct 2013 20:47:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Oct 2013 20:47:17 +0000 X-ASF-Spam-Status: No, hits=2.8 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ullgren@gmail.com designates 209.85.220.172 as permitted sender) Received: from [209.85.220.172] (HELO mail-vc0-f172.google.com) (209.85.220.172) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Oct 2013 20:47:11 +0000 Received: by mail-vc0-f172.google.com with SMTP id hu8so977148vcb.3 for ; Wed, 09 Oct 2013 13:46:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=CE1Vwhn25tl4y92vsXd+Y7TmKX94pbc8F3MrlRdDGp4=; b=BjbQJRYX91sL5EQAoHO5YXHc7gk3VJVvqaQxD30fILO/rasr+Xge2/J+rES7JKJRDB iHzIWdPVYEdyqDfSzy6Ht6NWAO/Zb6Ty/XvU/Gp55iJg+yf5BWT93O9UjgeoEswCchdV iPaLSg909pvDHWtet7iSMKEmewn0hj9ERiT16IthyK5xlH6CqPqiUGF49s1+pdB1J3F2 QMu2VDQ9ivieJ+vPUDxx5rxDC6/2bqSpbQbzQG6z/+JmEjFByVymLIAD5G9Jv9//+xD4 nAqT40VvL/WNUYKTLhplMQvPeh58i1SReGDgCPDFjRSbjhc+q/89rAG06unWjkDI0FuK 8JNw== MIME-Version: 1.0 X-Received: by 10.52.27.170 with SMTP id u10mr732383vdg.103.1381351610291; Wed, 09 Oct 2013 13:46:50 -0700 (PDT) Received: by 10.221.51.147 with HTTP; Wed, 9 Oct 2013 13:46:50 -0700 (PDT) In-Reply-To: <1381349345915-5741247.post@n5.nabble.com> References: <1381323011319-5741235.post@n5.nabble.com> <1381349345915-5741247.post@n5.nabble.com> Date: Wed, 9 Oct 2013 22:46:50 +0200 Message-ID: Subject: Re: Consume files periodically or on demand From: Pontus Ullgren To: users@camel.apache.org Content-Type: multipart/alternative; boundary=20cf307c9d000a9f1304e854fcf5 X-Virus-Checked: Checked by ClamAV on apache.org --20cf307c9d000a9f1304e854fcf5 Content-Type: text/plain; charset=UTF-8 You could create the file consuming route with autoStart(false). Then have a separate "controller" route that starts the first route on incoming message. Have a look at the Controlbus EIP[1] [1] http://camel.apache.org/controlbus.html // Pontus On Wed, Oct 9, 2013 at 10:09 PM, christoffer wrote: > Hi, > > thank you very much for your great input. > I tried using the approach with pollEnrich - but that only consumes one > file > from the (potentially) many files. > > I figured out the following approach using pollEnrich > from(demandFileConsumption).pollEnrich(fileEndpointName + > "?sendEmptyMessageWhenIdle=true").choice() > .when(body().isNull()).stop() > .otherwise().wireTap(demandFileConsumption, false, > constant("trigger")).to("mock:result").endChoice(); > > demandFileConsumption is direct endpoint URI and fileEndpointName is a file > endpoint URI. When I send a message to demandFileConsumption, this will > consume the first file, which in turn trigger the consumption of the next > file via the wireTap. If the source directory is drained of files the > content based router shuts down the polling for files. > This seems to work; is there a cleaner or more "camelish" approach. I think > using the approach would basically be the same idea. > Thanks for your input and keep ridin', chris > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Consume-files-periodically-or-on-demand-tp5741235p5741247.html > Sent from the Camel - Users mailing list archive at Nabble.com. > --20cf307c9d000a9f1304e854fcf5--