You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2010/08/24 17:04:49 UTC

[jira] Resolved: (AMQNET-275) Session throws not in transaction error when no message has been received during transactional session

     [ https://issues.apache.org/activemq/browse/AMQNET-275?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish resolved AMQNET-275.
---------------------------------

    Resolution: Fixed

Fixed in trunk.

> 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: Timothy Bish
>            Priority: Critical
>         Attachments: SessionInInvalidState.patch
>
>
> 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.