Return-Path: Delivered-To: apmail-camel-dev-archive@www.apache.org Received: (qmail 14480 invoked from network); 7 Sep 2010 10:31:26 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Sep 2010 10:31:26 -0000 Received: (qmail 55036 invoked by uid 500); 7 Sep 2010 10:31:26 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 54910 invoked by uid 500); 7 Sep 2010 10:31:23 -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 54900 invoked by uid 99); 7 Sep 2010 10:31:22 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Sep 2010 10:31:22 +0000 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Sep 2010 10:31:15 +0000 Received: from sam.nabble.com ([192.168.236.26]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1OsvS1-0001ow-TT for dev@camel.apache.org; Tue, 07 Sep 2010 03:30:53 -0700 Date: Tue, 7 Sep 2010 03:30:53 -0700 (PDT) From: RomualdoGobbo To: dev@camel.apache.org Message-ID: <1283855453883-2805911.post@n5.nabble.com> Subject: Messages queue filtered depending on info received by another queue 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 All, I've the following problem unsolved regarding the filtered messages depending on some info extractect from another queue. The case is the following: 1. Primary queue contains the messages received from netty:tcp server 2.Depending the ID found in the body you have to select from another queue only the messages affected to the previous ID, leaving the other messages in the queue. 3. The returning message will be the message (if found) on the second queue, otherwise all remains unchanged. I've solved only partially the problem using the following camelcontext.xml: --> due to the process myBeanId that is unable to leave the messages in the original queue (see the following code), but all messages must be consumed to know the body content: // MyBeanProcessor.java package org.apache.camel.example; import java.io.*; import org.apache.camel.Exchange; import org.apache.camel.processor.aggregate.AggregationStrategy; public class MyBeanProcessor implements AggregationStrategy { public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { if (newExchange == null) { // no messages in queue return newExchange; } String payloadOld = oldExchange.getIn().getBody(String.class); String payloadNew = newExchange.getIn().getBody(String.class); String telelink = payloadOld.substring(5, 14); if (payloadNew.contains("#") & payloadNew.contains(telelink)) { System.out.println("OK " + telelink + "=" + payloadNew); oldExchange.getIn().setBody(payloadNew.substring(10)); } else { System.out.println("NO OK " + telelink + "<>" + payloadNew); oldExchange.getIn().setBody(null); } return oldExchange; } } Many thanks for your help, Romualdo -- View this message in context: http://camel.465427.n5.nabble.com/Messages-queue-filtered-depending-on-info-received-by-another-queue-tp2805911p2805911.html Sent from the Camel Development mailing list archive at Nabble.com.