Why do you use a topic and not a queue if you only have one consumer? Best, Christian -----------------
Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Sun, Aug 4, 2013 at 10:04 AM, Nhan Nguyen <ntnha...@gmail.com> wrote: > 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. >