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 6B720DCE9 for ; Tue, 21 May 2013 07:48:07 +0000 (UTC) Received: (qmail 35593 invoked by uid 500); 21 May 2013 07:48:07 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 35555 invoked by uid 500); 21 May 2013 07:48:06 -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 35525 invoked by uid 99); 21 May 2013 07:48:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 May 2013 07:48:06 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jflebescont@gmail.com designates 209.85.214.174 as permitted sender) Received: from [209.85.214.174] (HELO mail-ob0-f174.google.com) (209.85.214.174) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 May 2013 07:47:59 +0000 Received: by mail-ob0-f174.google.com with SMTP id fb19so355652obc.5 for ; Tue, 21 May 2013 00:47:38 -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=p+p3zU76PUN/38M9TWUfx5TnLP9sByXpJfFDfQPzP7o=; b=AUwqaZ9MssG8UI9Jm4Ngw2cwCbNxU38EDmd7anSvBUim0qvcKX6ZUsCDAhZXpd79WP 3GDPmla6CgGcg2rQIAU35Wd55B3CWfN04HRYZr1/9Z11pWS//RbLfTyYzgnQPKpujqLV HwXlKk+QissbpvgltPc/otVUKom2apegIuOJlkcNBiCYnlkDwRT+tgF3jHTFWtRAYKAC mI5duWMXdBq69MBfSjeSzGUhjVM9NMdM56vWPJ2l23cU/l2uCCWc7izF76l8RGbbVatO oWxH3ieu4tkQoaizd0IJhf/l4fOLvGtLp3L9ax1ZzxH4Rkmvg9NWl4vl+gO5dn1VUSPY bZ+Q== MIME-Version: 1.0 X-Received: by 10.60.60.104 with SMTP id g8mr612138oer.125.1369122458202; Tue, 21 May 2013 00:47:38 -0700 (PDT) Received: by 10.60.117.131 with HTTP; Tue, 21 May 2013 00:47:38 -0700 (PDT) In-Reply-To: References: Date: Tue, 21 May 2013 09:47:38 +0200 Message-ID: Subject: Re: stream:file closeOnDone not close all time From: Jean Francois LE BESCONT To: users@camel.apache.org Content-Type: multipart/alternative; boundary=089e0149cb8ec67d4304dd35a9e8 X-Virus-Checked: Checked by ClamAV on apache.org --089e0149cb8ec67d4304dd35a9e8 Content-Type: text/plain; charset=ISO-8859-1 Hi, Sorry if I spam ( I also speak in jira ) Hi, ( Sorry if I spam, I also speak in jira ) I have found a solution, based on the idea of send the exchange to both endpoint : public void configure() throws Exception { // Properties final String PROP_WRITE_IN_FILE_1 = "PROP_WRITE_IN_FILE_1"; final String PROP_WRITE_IN_FILE_2 = "PROP_WRITE_IN_FILE_2"; // Routes final String ROUTE_FILE_1 = "direct:ROUTE_FILE_1" ; final String ROUTE_FILE_2 = "direct:ROUTE_FILE_2" ; // MAIN ROUTE from("file://C:/Temp/camel/rep1/?noop=true") .log("start process file => ${file:name}") .split() .tokenize("\n").streaming().process(new Processor() { public void process(Exchange exchange) throws Exception { // After 2 lines, next lines are rejected via an // exchange property i++; if (i <= 2) { exchange.setProperty(PROP_WRITE_IN_FILE_1, true); exchange.setProperty(PROP_WRITE_IN_FILE_2, false); } else { exchange.setProperty(PROP_WRITE_IN_FILE_1, false); exchange.setProperty(PROP_WRITE_IN_FILE_2, true); } } }) .multicast().parallelProcessing() .to(ROUTE_FILE_1 , ROUTE_FILE_2 ) .end() .log("end process file => ${file:name}") .end(); // OUT FILE 1 from(ROUTE_FILE_1) .process(new Processor() { public void process(Exchange exchange) throws Exception { if( ! exchange.getProperty(PROP_WRITE_IN_FILE_1, Boolean.class).booleanValue()) exchange.getIn().setBody(null); } }) .to("stream:file?fileName=C:/Temp/camel/rep1/out/out_1.csv&closeOnDone=true") .end(); // OUT FILE 2 from( ROUTE_FILE_2) .process(new Processor() { public void process(Exchange exchange) throws Exception { if( ! exchange.getProperty(PROP_WRITE_IN_FILE_2, Boolean.class).booleanValue()) exchange.getIn().setBody(null); } }) .to("stream:file?fileName=C:/Temp/camel/rep1/out/out_2.csv&closeOnDone=true") .end(); } It complicate the process but it works... For me camel doesn't manage correctly the Content Based Router from the EIP patterns in the file:stream component --089e0149cb8ec67d4304dd35a9e8--