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 9D3C0EC0C for ; Thu, 28 Feb 2013 13:18:42 +0000 (UTC) Received: (qmail 14230 invoked by uid 500); 28 Feb 2013 13:18:41 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 14040 invoked by uid 500); 28 Feb 2013 13:18:41 -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 14012 invoked by uid 99); 28 Feb 2013 13:18:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Feb 2013 13:18:40 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.223.174 as permitted sender) Received: from [209.85.223.174] (HELO mail-ie0-f174.google.com) (209.85.223.174) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Feb 2013 13:18:36 +0000 Received: by mail-ie0-f174.google.com with SMTP id k10so1992401iea.19 for ; Thu, 28 Feb 2013 05:18:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=tfjyedSYLRmgvgz4sAFOFMe913SwZRG00v/JJViI0Ug=; b=w1FQdERmHRamN9ekhRXZgYACjVbBJS2yKWyYpsgy/sOZpw2SeXouJf7BBn2ggVjVqV JP/cfKQL788xEeDnctvAOyG/mDERSvgPokmxl2yUmUvt8+sh2ItvKXZomqRw1wt8Zo4W NebujnMmVsFws6e380AvCAfPOVL6ANhbnqIwmFt2fnRtLWAq+7xBUqE4cHjXg3AifbHF n/35Ae6U232UP5sxAXyrPlGzztF11WfmkkLlnYeX8rVznShbPvG/jyPvxxXSzCdD5bUx cV7XEOenyhChsc+gUI6woIZAGWqeKnjK9caWGutrSOTRj3fpmIgCNcHFPfNkCsg283qJ QFMA== X-Received: by 10.50.194.200 with SMTP id hy8mr3625255igc.3.1362057495720; Thu, 28 Feb 2013 05:18:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.53.232 with HTTP; Thu, 28 Feb 2013 05:17:54 -0800 (PST) In-Reply-To: <1362053025196-5728292.post@n5.nabble.com> References: <1361481036524-5727977.post@n5.nabble.com> <5127A03B.7060900@gmail.com> <1361567095301-5728045.post@n5.nabble.com> <5127E163.5030609@gmail.com> <1362053025196-5728292.post@n5.nabble.com> From: Claus Ibsen Date: Thu, 28 Feb 2013 14:17:54 +0100 Message-ID: Subject: Re: Large file processing with Apache Camel To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Feb 28, 2013 at 1:03 PM, cristisor wrote: > After digging more into my problem I found that the slow db access was the > main issue, maybe you heard before of setting > sendStringParametersAsUnicode=false in the jdbc driver to dramatically > increase the performance. > > Since the last time I posted here I learned a lot about apache camel and I > implemented some nice changes, but I'm confronting with a synchronization > problem right now. I split each line that comes from the file and I enable > parallel processing: > from().split(body(String.class).tokenize("\n")).parallelProcessing().process(processor).to() > > Inside this processor I take the line, send it to the xml mapper as an input > stream and in the end I set the xml as the body of the out message. The > processor's process method is not synchronized and I run into situations > where the input line has a code "1234" and the output doesn't contain the > code "1234" but "1235", but this code belongs to another line 100% sure. So > I should control the synchronization process by myself, right? > > If you run in parallel processing mode, then the lines can be processed out of order and concurrently. Also your custom processor will be invoked concurrently by multiple threads as they process the lines in parallel. So you have to write your code in a thread safe manner, if you want to access shared resources. > > -- > View this message in context: http://camel.465427.n5.nabble.com/Large-file-processing-with-Apache-Camel-tp5727977p5728292.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: cibsen@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen