Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 36541 invoked from network); 30 Mar 2010 11:14:06 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 30 Mar 2010 11:14:06 -0000 Received: (qmail 35864 invoked by uid 500); 30 Mar 2010 11:14:06 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 35719 invoked by uid 500); 30 Mar 2010 11:14:05 -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 35706 invoked by uid 99); 30 Mar 2010 11:14:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Mar 2010 11:14:04 +0000 X-ASF-Spam-Status: No, hits=1.8 required=10.0 tests=MISSING_MID,RCVD_IN_BRBL_LASTEXT,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [211.99.232.114] (HELO tongtech.com) (211.99.232.114) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 30 Mar 2010 11:13:55 +0000 Received: from IBM0618 (unknown [124.42.76.2]) by tongtech.com with CMailServer 5.3 SMTP; Tue, 30 Mar 2010 19:13:36 +0800 From: "ext2" To: Subject: exhausted usage of splitter-pattern Date: Tue, 30 Mar 2010 19:13:33 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcrP75u1/TYI8dNfTPac8OAJ/M2TGQAAuHWw In-Reply-To: <1269943098.20599.1367428043@webmail.messagingengine.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Virus-Checked: Checked by ClamAV on apache.org Message-Id: <20100330111403.4B47C816020@nike.apache.org> Hi: Previously , I have ask some question about splitter, and the stream-based splitter pattern can resolve such situations: Enumerate data from large external data source, and process each data continuously until all data from external-data source is readed; But resolve such problem, Usage of Camel's splitter pattern is very exhausted; to illustrate it , let's have a example: read a condition from jms queue. According to the condition , enumerate a external file's content line by line; and we do same operations on each line; Although we could use streamed splitter pattern to resolve this problem, as following : 1: write my custom iterater to enumerate content from external file; 2: using streamed-splitter to process each line from file; 3: using a doTry-doFianlly to close the iterater; But the real exhausted thing is how to close the iterator, while execute the process concurrent-ly; 1) I must using a bean to create the iterator; it seems like : 2) I must close the iterator while split finished, it looks like But configured as above cannot execute concurrently, because the bean itself cannot ensure to close iterator thread-safely; In order ensure concurrently execute safe, I must save iterator in the Exchange's property and close it by property; it looks like as following and the following things look like too exhausted. So does camel provide a better choice to resolve such problems? ... //here is too exhausted, because I cannot get a bean from message and invoke it's method; Class CloseIteratorByProperty implement Process { Void process(Exchange ex) { Iterator iter = Ex.getProperty("iteratorId"); ((implementation class)iter).close(); } }