activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michel Van Hoof (JIRA)" <>
Subject [jira] Commented: (AMQNET-217) AcknowledgementMode.Transactional Broken (Apache.NMS.NMSException: Invliad State: Not Currently in a Transaction)
Date Thu, 10 Dec 2009 15:25:54 GMT


Michel Van Hoof commented on AMQNET-217:

Hmm.. While writing up the test case i noticed that i did not receive the error.. ONLY when
i try to comit a session which has already been commited. So I am afraid i cryed to soon..
Apparently somewhere i missed the extra Session.Commit() in our code (which in the past did
not throw an exception with and does now :s

I'll have to check back in the code where this exactly happens. 

I did notice another "behaviour" i have not seen before.. When setting a destination on a
producer during creation (Session.CreateProducer(iDestionation), it can no longer be overwritten
later  using Producer.send(idestionation,iMessage)

is this correct ?

Test code showing that the producer later on keeps writing to the idestionation that was used
during Creation:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Apache.NMS;
using Apache.NMS.ActiveMQ;

namespace TransactionTest
    class Program
        static void Main(string[] args)
            IConnectionFactory oFactory = new ConnectionFactory("failover:(tcp://");
            IDestination oDestionation = new Apache.NMS.ActiveMQ.Commands.ActiveMQQueue("trans.test");
            IDestination oDLQ = new Apache.NMS.ActiveMQ.Commands.ActiveMQQueue("trans.test.DLQ");
            IConnection oConnection = oFactory.CreateConnection();

            ISession oProducerSession = oConnection.CreateSession();
            ISession oSession = oConnection.CreateSession(AcknowledgementMode.Transactional);
            IMessageProducer oProducer = oProducerSession.CreateProducer(oDestionation);
            for (int i = 0; i < 5; i++)
                oProducer.Send(oDestionation,oProducer.CreateTextMessage("Iteration: " + i.ToString()));
            Console.WriteLine("Sending testmessages DONE");
            //now.. for the consuming Part...

            IMessageConsumer oConsumer = oSession.CreateConsumer(oDestionation);

            while (true)

                IMessage oMessage = oConsumer.Receive(new TimeSpan(0, 0, 10));
                if (oMessage != null)
                    ITextMessage oText = (ITextMessage)oMessage;
                        //processing message and then throw an error...
                        throw new Exception("I have been a naughty process and made a booboo");
                    catch (Exception)
                        //processing did error so should DLQ
                        ITextMessage oDLQMessage = oProducer.CreateTextMessage();
                        oDLQMessage.Text = "Error During Message: " + oText.Text;
                        catch (Exception e)
                            //ERROR happens here





> AcknowledgementMode.Transactional Broken (Apache.NMS.NMSException: Invliad State: Not
Currently in a Transaction)
> -----------------------------------------------------------------------------------------------------------------
>                 Key: AMQNET-217
>                 URL:
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ
>    Affects Versions: 1.2.0
>         Environment: Win XP  SP3 , Windows 2003 Server, Windows 2008 server
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
> One of our application that is using the NMS library was upgraded to for
testing. Same code working nicely with all of the sudden started to return errors
stating that the session is not in transactional mode altough this is the case.

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

View raw message