Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E0E021175C for ; Mon, 21 Apr 2014 23:31:39 +0000 (UTC) Received: (qmail 92746 invoked by uid 500); 21 Apr 2014 23:31:38 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 92649 invoked by uid 500); 21 Apr 2014 23:31:38 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 92641 invoked by uid 99); 21 Apr 2014 23:31:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Apr 2014 23:31:38 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of vinaykumar258@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; Mon, 21 Apr 2014 23:31:33 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1WcNg8-00066m-31 for dev@camel.apache.org; Mon, 21 Apr 2014 16:31:12 -0700 Date: Mon, 21 Apr 2014 16:31:12 -0700 (PDT) From: vknfh3 To: dev@camel.apache.org Message-ID: <1398123072055-5750407.post@n5.nabble.com> Subject: Concurrency issue with SEDA component MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi, I have been facing concurrency issues with SEDA component when using it for parallely processing 200 or more JSON Messages. Our application should be able to process and save at least 200 JSONS at a time from each user simultaneously. The SEDA component route seems to be working fine when only one user is issuing 200 JSON requests(which will be enclosed in a JSONArray). I'm running into issues when another user is hitting the same SEDA route at the same time when the old request from other user is still in progress. Due to this the output JSON messages are being duplicated and in some instances getting more JSON messages back than expected!! Before using SEDA component I tried using split and parallellProcessing and I ran into similar kind of concurrency issues. Here is what I have: from("seda:savesupplyitemsplitter?timeout=0&waitForTaskToComplete=Always&concurrentConsumers=200") .routeId("SaveSupplyItemSplitter") .setProperty(SupplyItemRoutesConstants.JSON_ARRAY_MSG, body()) .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { List supplyItemList = (List) exchange.getIn().getBody(List.class); exchange.setProperty(SupplyItemRoutesConstants.JSON_ARRAY_MSG, supplyItemList); if(!supplyItemList.isEmpty() || supplyItemList.size()!=0){ JSONObject sItem = supplyItemList.get(0); //Get the first element from the List exchange.getOut().setBody(sItem); //set the supplyItem as body to the exchange } } }) .process(new SupplierNumberProcessor()) .enrich(SupplyItemRoutesConstants.GET_SUPPLIER_GLN_ENDPOINT, new SupplyItemGLNAggregator()) .split(simple(SupplyItemRoutesConstants.BODY_STRING), new SupplyItemDataAggregator()) .to("direct:savesupplyitem") .end(); from("direct:savesupplyitem") //complex route with lot of external service calls and calls to other camel enpoints. This route also has lot processors and aggregators. All the routes that this endpoint calls are "direct" end points . to(some complex processing and saving to database) .end(); I have uploaded the code for the above route (direct:savesupplyitem) as separate file for your reference: SaveSupplyItemRoutes.txt Do I need to do anything to make it work for multiple users (more than one user will call the seda endpoint simultaneously)? Am I missing something here ? Please suggest. Thanks -- View this message in context: http://camel.465427.n5.nabble.com/Concurrency-issue-with-SEDA-component-tp5750407.html Sent from the Camel Development mailing list archive at Nabble.com.