[prev in list] [next in list] [prev in thread] [next in thread]
List: activemq-commits
Subject: svn commit: r948463 - in /activemq/trunk/activemq-core/src:
From: gtully () apache ! org
Date: 2010-05-26 14:52:20
Message-ID: 20100526145220.C3C7323889E5 () eris ! apache ! org
[Download RAW message or body]
Author: gtully
Date: Wed May 26 14:52:20 2010
New Revision: 948463
URL: http://svn.apache.org/viewvc?rev=948463&view=rev
Log:
resolve https://issues.apache.org/activemq/browse/AMQ-2751 - duplicate suppression \
over eager with listener, session.recover from a message listener when default \
delayed redelivery is in place
Added:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2751Test.java \
(with props) Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java?rev=948463&r1=948462&r2=948463&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java \
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java \
Wed May 26 14:52:20 2010 @@ -1232,6 +1232,7 @@ public class ActiveMQMessageConsumer \
imp }
}
} else {
+ session.connection.rollbackDuplicate(this, \
md.getMessage()); unconsumedMessages.enqueue(md);
if (availableListener != null) {
availableListener.onMessageAvailable(this);
Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2751Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2751Test.java?rev=948463&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2751Test.java \
(added)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2751Test.java \
Wed May 26 14:52:20 2010 @@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.bugs;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.EmbeddedBrokerTestSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class AMQ2751Test extends EmbeddedBrokerTestSupport {
+ private static final Log LOG = LogFactory.getLog(AMQ2751Test.class);
+
+ private static String clientIdPrefix = "consumer";
+ private static String queueName = "FOO";
+
+ public void testRecoverRedelivery() throws Exception {
+
+ final CountDownLatch redelivery = new CountDownLatch(6);
+ final ActiveMQConnectionFactory factory = new \
ActiveMQConnectionFactory("failover:(" + this.bindAddress + ")"); + try {
+
+ Connection connection = factory.createConnection();
+ String clientId = clientIdPrefix;
+ connection.setClientID(clientId);
+
+ final Session session = connection.createSession(false, \
Session.CLIENT_ACKNOWLEDGE); +
+ Queue queue = session.createQueue(queueName);
+
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ consumer.setMessageListener(new MessageListener() {
+ public void onMessage(Message message) {
+ try {
+ LOG.info("Got message: " + message.getJMSMessageID());
+ if (message.getJMSRedelivered()) {
+ LOG.info("It's a redelivery.");
+ redelivery.countDown();
+ }
+ LOG.info("calling recover() on the session to force \
redelivery."); + session.recover();
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ System.out.println("Created queue consumer with clientId " + clientId);
+ connection.start();
+
+ MessageProducer producer = session.createProducer(queue);
+ producer.send(session.createTextMessage("test"));
+
+ assertTrue("we got 6 redeliveries", redelivery.await(20, \
TimeUnit.SECONDS)); +
+ } finally {
+ broker.stop();
+ }
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ bindAddress = "tcp://0.0.0.0:61617";
+ super.setUp();
+ }
+}
Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2751Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2751Test.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic