[ https://issues.apache.org/activemq/browse/AMQNET-217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56357#action_56357 ]
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 1.1.0.0 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: {code:title=TransActionTest.exe|borderStyle=solid} 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://10.32.1.24:1414)"); 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(); oConnection.Start(); 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; try { //processing message and then throw an error... Console.WriteLine(oText.Text); throw new Exception("I have been a naughty process and made a booboo"); oMessage.Acknowledge(); oSession.Commit(); } catch (Exception) { //processing did error so should DLQ ITextMessage oDLQMessage = oProducer.CreateTextMessage(); oDLQMessage.Text = "Error During Message: " + oText.Text; oProducer.Send(oDLQ,oDLQMessage); Console.WriteLine(oDLQ.ToString()); oMessage.Acknowledge(); try { oSession.Commit(); } catch (Exception e) { //ERROR happens here Console.WriteLine(e.ToString()); } } } else { break; } System.Threading.Thread.Sleep(100); } Console.ReadKey(); } } } {code} > AcknowledgementMode.Transactional Broken (Apache.NMS.NMSException: Invliad > State: Not Currently in a Transaction) > ----------------------------------------------------------------------------------------------------------------- > > Key: AMQNET-217 > URL: https://issues.apache.org/activemq/browse/AMQNET-217 > 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 > 1.2.0.0-RC1 for testing. Same code working nicely with 1.1.0.0 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.