activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michel Van Hoof (JIRA)" <jira+amq...@apache.org>
Subject [jira] Created: (AMQNET-275) Session throws not in transaction error when no message has been received during transactional session
Date Mon, 23 Aug 2010 14:17:47 GMT
Session throws not in transaction error when no message has been received during transactional
session
------------------------------------------------------------------------------------------------------

                 Key: AMQNET-275
                 URL: https://issues.apache.org/activemq/browse/AMQNET-275
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: ActiveMQ
    Affects Versions: 1.3.0
         Environment: Any
            Reporter: Michel Van Hoof
            Assignee: Jim Gomes
            Priority: Critical


When trying to upgrade the NMS libraries in the MassTransit, i noticed i started receiving
exceptions:
<code>
Apache.NMS.NMSException: Invliad State: Not Currently in a Transaction
   at Apache.NMS.ActiveMQ.TransactionContext.Commit()
   at Apache.NMS.ActiveMQ.Session.Commit()
   at MassTransit.Transports.Nms.NmsTransport.Receive(Func`2 receiver, TimeSpan timeout) in
D:\Development.OSS\Masstransit\src\Transports\MassTransit.Transports.Nms\NmsTransport.cs:line
112
   at MassTransit.Transports.StreamEndpoint.Receive(Func`2 receiver, TimeSpan timeout) in
D:\Development.OSS\Masstransit\src\MassTransit\Transports\StreamEndpoint.cs:line 65
   at MassTransit.Internal.ServiceBusReceiveContext.ReceiveFromEndpoint() in D:\Development.OSS\Masstransit\src\MassTransit\Internal\ServiceBusReceiveContext.cs:line
62
</code>

Looking further into this, i noticed that these only occur when trying to consume a message
from the queue in transactional acknowledgement mode when NO mesasge is received in the timespan
configured.

A simple test i did show this:

<code>

[Test]
        public void session_can_be_commited_without_receiving_message()
        {
            
            
                using (Session testsession = connection.CreateSession(AcknowledgementMode.Transactional)
as Session)
                {
                    Assert.IsTrue(testsession.Transacted);
                   // Assert.IsTrue(testsession.TransactionContext.InTransaction);
                    using (IMessageConsumer oTestConsumer = testsession.CreateConsumer(new
ActiveMQ.Commands.ActiveMQQueue(destinationName)))
                    {

                        IMessage oreceived = oTestConsumer.Receive(new TimeSpan(0, 0, 0, 0,
100));
                        Assert.IsNull(oreceived);
                        testsession.Commit();





                    }
                }

                Assert.Pass("When getting here. It is ok");
        }
</code>



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message