activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: Transactional message consumption
Date Thu, 10 Sep 2009 08:39:49 GMT
can you raise a jira - and attach a junit test case (granting rights  
to Apache) ?
On 9 Sep 2009, at 23:17, gnoremac wrote:

>
> Hi
>
> I am not sure if I am missing something really simple but if I run  
> the below
> test case I notice the following exception in my logs. If I change the
> rollback to a commit it goes away. Can anyone help with what I am  
> doing
> wrong.
>
> public void activeMQTest() throws Exception {
>        Destination dest = ActiveMQQueue.createDestination("testQueue",
> ActiveMQQueue.QUEUE_TYPE);
>        ConnectionFactory factory = new ActiveMQConnectionFactory(
>
> "vm://localhost?broker.useJmx=false&broker.persistent=false");
>        Connection producerConnection = factory.createConnection();
>        producerConnection.start();
>        Connection consumerConnection = factory.createConnection();
>        consumerConnection.start();
>
>        Session producerSession =  
> producerConnection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
>        MessageProducer producer =  
> producerSession.createProducer(dest);
>        TextMessage sentMsg =  
> producerSession.createTextMessage("test...");
>        producer.send(sentMsg);
>        producerSession.close();
>
>        Session consumerSession =  
> consumerConnection.createSession(true,
> Session.SESSION_TRANSACTED);
>        MessageConsumer consumer =  
> consumerSession.createConsumer(dest);
>        TextMessage receivedMsg = (TextMessage)consumer.receive();
>        consumerSession.rollback();
>        consumerSession.close();
>
>        assertEquals(sentMsg, receivedMsg);
>
>        producerConnection.close();
>        consumerConnection.close();
>    }
>
> 15:13:39.032 [ActiveMQ Connection Worker: vm://localhost#2] - Async
> exception with no exception listener: javax.jms.JMSException:  
> Transaction
> 'TX:ID:cg-gr-44532-1252534418412-2:1:1' has not been started.
> javax.jms.JMSException: Transaction 'TX:ID:cg- 
> gr-44532-1252534418412-2:1:1'
> has not been started.
> 	at
> org 
> .apache 
> .activemq 
> .broker.TransactionBroker.getTransaction(TransactionBroker.java:270)
> 	at
> org 
> .apache 
> .activemq 
> .broker.TransactionBroker.acknowledge(TransactionBroker.java:190)
> 	at
> org 
> .apache.activemq.broker.BrokerFilter.acknowledge(BrokerFilter.java:74)
> 	at
> org 
> .apache.activemq.broker.BrokerFilter.acknowledge(BrokerFilter.java:74)
> 	at
> org 
> .apache 
> .activemq 
> .broker.MutableBrokerFilter.acknowledge(MutableBrokerFilter.java:85)
> 	at
> org 
> .apache 
> .activemq 
> .broker 
> .TransportConnection.processMessageAck(TransportConnection.java:456)
> 	at org.apache.activemq.command.MessageAck.visit(MessageAck.java:205)
> 	at
> org 
> .apache 
> .activemq 
> .broker.TransportConnection.service(TransportConnection.java:305)
> 	at
> org.apache.activemq.broker.TransportConnection 
> $1.onCommand(TransportConnection.java:179)
> 	at
> org 
> .apache 
> .activemq 
> .transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:104)
> 	at
> org 
> .apache 
> .activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
> 	at
> org 
> .apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java: 
> 205)
> 	at
> org 
> .apache 
> .activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
> 	at
> org.apache.activemq.thread.PooledTaskRunner 
> $1.run(PooledTaskRunner.java:43)
> 	at
> java.util.concurrent.ThreadPoolExecutor 
> $Worker.runTask(ThreadPoolExecutor.java:886)
> 	at
> java.util.concurrent.ThreadPoolExecutor 
> $Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:619)
>
> Thanks
> -- 
> View this message in context: http://www.nabble.com/Transactional-message-consumption-tp25374091p25374091.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Rob Davies
I work here: http://fusesource.com
My Blog: http://rajdavies.blogspot.com/
I'm writing this: http://www.manning.com/snyder/





Mime
View raw message