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 5C74D10BBF for ; Sun, 4 Aug 2013 08:05:39 +0000 (UTC) Received: (qmail 6361 invoked by uid 500); 4 Aug 2013 08:05:38 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 6028 invoked by uid 500); 4 Aug 2013 08:05:34 -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 6020 invoked by uid 99); 4 Aug 2013 08:05:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Aug 2013 08:05:33 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: encountered temporary error during SPF processing of domain of ntnhan94@gmail.com) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Aug 2013 08:05:28 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1V5tJ2-0005FE-9j for users@camel.apache.org; Sun, 04 Aug 2013 01:04:48 -0700 Date: Sun, 4 Aug 2013 01:04:48 -0700 (PDT) From: Nhan Nguyen To: users@camel.apache.org Message-ID: <1375603487590-5736733.post@n5.nabble.com> Subject: The producer sent only one message but the comsumer received multiple messages with same content. 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 am using a Topic to send and receive the message: from("jms:topic:topic1").process(new Processor() { @Override public void process(Exchange exchange) throws Exception { System.out.println(exchange.getIn().getBody()); } }); The code to send the message: endPoint = getCamelContext().getEndpoint("jms:topic:topic1", JmsEndpoint.class); producer = getCamelContext().createProducerTemplate(); int i = 0; while(true){ Exchange exchange = endpoint.createExchange(); exchange.setPattern(ExchangePattern.InOnly); exchange .setBody(i++); m_producer.send(endPoint, exchange); Thread.sleep(1000); } I sent a message, wait for 1second, then send another with the content is i++. And the output I saw: 0 1 1 2 2 2 3 3 3 3 Why did I receive so many same messages? I expected the result must be: 0 1 2 3 Can someone help me on this? Thanks! -- View this message in context: http://camel.465427.n5.nabble.com/The-producer-sent-only-one-message-but-the-comsumer-received-multiple-messages-with-same-content-tp5736733.html Sent from the Camel - Users mailing list archive at Nabble.com.