Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 20117 invoked from network); 12 May 2009 12:39:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 May 2009 12:39:14 -0000 Received: (qmail 58356 invoked by uid 500); 12 May 2009 12:39:14 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 58300 invoked by uid 500); 12 May 2009 12:39:13 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 58290 invoked by uid 99); 12 May 2009 12:39:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2009 12:39:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2009 12:39:11 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 838D4234C051 for ; Tue, 12 May 2009 05:38:51 -0700 (PDT) Message-ID: <1148914101.1242131931537.JavaMail.jira@brutus> Date: Tue, 12 May 2009 05:38:51 -0700 (PDT) From: "Dave Syer (JIRA)" To: dev@activemq.apache.org Subject: [jira] Commented: (AMQ-2233) After rollback received messages not re-presented In-Reply-To: <1205772728.1240920580103.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQ-2233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51636#action_51636 ] Dave Syer commented on AMQ-2233: -------------------------------- Thanks for the update. I tried (as previously indicated) the prefetch hint and it didn't change anything. If I understand the comment correctly maybe you misunderstood the test case: it doesn't fail because "bar" is unavailable to a second consumer - in fact it is, as the assertion {{assertEquals(2, list.size())}} in the test method shows. It fails because neither "foo" nor "bar" is available to any consumer whatsoever, after the rollback has occurred. The transaction has certainly completed by the time the test fails (thecomment seems to imply the opposite, but maybe I misunderstood). It still fails for you, right? (I only ran it against 5.2.0.) > After rollback received messages not re-presented > ------------------------------------------------- > > Key: AMQ-2233 > URL: https://issues.apache.org/activemq/browse/AMQ-2233 > Project: ActiveMQ > Issue Type: Bug > Affects Versions: 5.2.0 > Reporter: Dave Syer > Assignee: Gary Tully > Attachments: RawRollbackTests.java > > > After rollback received messages not re-presented. If I receive in a transaction and then roll back the messages should be re-presented in the next transaction. This used to work in 5.1.0, but is broken in 5.2.0. > You can browse the Queue in JMX after the rollback and see that the messages are still there, but they are not received by a consumer in the same process. > Here's a test case (fails on the checkPostConditions()): > {code} > public class RawRollbackTests { > > private static ConnectionFactory connectionFactory; > private static Destination queue; > private static BrokerService broker; > @BeforeClass > public static void clean() throws Exception { > FileUtils.deleteDirectory(new File("activemq-data")); > broker = new BrokerService(); > broker.setUseJmx(true); > broker.start(); > ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); > connectionFactory.setBrokerURL("vm://localhost?async=false"); > RawRollbackTests.connectionFactory = connectionFactory; > queue = new ActiveMQQueue("queue"); > } > @AfterClass > public static void close() throws Exception { > broker.stop(); > } > @Before > public void clearData() throws Exception { > getMessages(false); // drain queue > convertAndSend("foo"); > convertAndSend("bar"); > } > @After > public void checkPostConditions() throws Exception { > Thread.sleep(1000L); > List list = getMessages(false); > assertEquals(2, list.size()); > } > @Test > public void testReceiveMessages() throws Exception { > List list = getMessages(true); > assertEquals(2, list.size()); > assertTrue(list.contains("foo")); > } > > private void convertAndSend(String msg) throws Exception { > Connection connection = connectionFactory.createConnection(); > connection.start(); > Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); > MessageProducer producer = session.createProducer(queue); > producer.send(session.createTextMessage(msg)); > producer.close(); > session.commit(); > session.close(); > connection.close(); > } > private List getMessages(boolean rollback) throws Exception { > Connection connection = connectionFactory.createConnection(); > connection.start(); > Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); > String next = ""; > List msgs = new ArrayList(); > while (next != null) { > next = (String) receiveAndConvert(session); > if (next != null) > msgs.add(next); > } > if (rollback) { > session.rollback(); > } else { > session.commit(); > } > session.close(); > connection.close(); > return msgs; > } > private String receiveAndConvert(Session session) throws Exception { > MessageConsumer consumer = session.createConsumer(queue); > Message message = consumer.receive(100L); > consumer.close(); > if (message==null) { > return null; > } > return ((TextMessage)message).getText(); > } > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.