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 7DC1E101E9 for ; Thu, 20 Mar 2014 17:25:20 +0000 (UTC) Received: (qmail 74178 invoked by uid 500); 20 Mar 2014 17:25:19 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 74148 invoked by uid 500); 20 Mar 2014 17:25:17 -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 74135 invoked by uid 99); 20 Mar 2014 17:25:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2014 17:25:16 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of omgolafguhl@gmail.com does not designate 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2014 17:25:12 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1WQgi4-0006fy-1N for users@camel.apache.org; Thu, 20 Mar 2014 10:24:52 -0700 Date: Thu, 20 Mar 2014 10:24:52 -0700 (PDT) From: Olaf To: users@camel.apache.org Message-ID: <1395336292034-5749157.post@n5.nabble.com> Subject: bean members with parallel processing MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hello, would the following route work correctly with multiple threads? In beanRef("TestProcessor", "step2") the instance variable mapper is used, so I suppose it is not thread safe, right? Should I set the mapper as a property of the exchange? from(inputsource) .beanRef("TestProcessor", "step1") .beanRef("TestProcessor", "step2") .beanRef("TestProcessor", "step3") .log("${body}") package testcamel; import java.util.Map; import org.apache.camel.Headers; public class TestProcessor { private String generator; private JsonMapper mapper; public String step1(String filedata, @Headers Map headers) { //create mapper for each new message mapper = new JsonMapper(); //do something here return "resultFromStep1"; } public String step2(String contentFromStep1) { //do something here with mapper mapper.doSomething(); return "resultFromStep2"; } public String step3(String contentFromStep2) { //do something here with mapper mapper.doSomething(); return "resultFromStep2"; } } -- View this message in context: http://camel.465427.n5.nabble.com/bean-members-with-parallel-processing-tp5749157.html Sent from the Camel - Users mailing list archive at Nabble.com.