Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 55E5D10D9E for ; Wed, 6 Nov 2013 08:11:29 +0000 (UTC) Received: (qmail 38256 invoked by uid 500); 6 Nov 2013 08:11:27 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 38220 invoked by uid 500); 6 Nov 2013 08:11:21 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 38188 invoked by uid 99); 6 Nov 2013 08:11:19 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Nov 2013 08:11:19 +0000 Date: Wed, 6 Nov 2013 08:11:19 +0000 (UTC) From: "Remo Gloor (JIRA)" To: dev@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AMQNET-413) Message producers do not respect DTC Transactions correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AMQNET-413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13814693#comment-13814693 ] Remo Gloor commented on AMQNET-413: ----------------------------------- Is there any intent to integrate the open patches or fix the related issues in any other way? I'm asking because we detected several issues with the newly added failover transport redelivery code. Fixing those for any possible acknowledge mode and Listener/NoListener combination will be much more work than just fixing our own case. If we have to maintain our own version anyway because the open patches are not applied then there is little reason to do this additional work to get it fixed for all situations. > Message producers do not respect DTC Transactions correctly > ----------------------------------------------------------- > > Key: AMQNET-413 > URL: https://issues.apache.org/jira/browse/AMQNET-413 > Project: ActiveMQ .Net > Issue Type: Bug > Components: ActiveMQ > Reporter: Remo Gloor > Assignee: Jim Gomes > Attachments: AMQNET-413.patch, AllMessagesAreAcknowledgedAndRolledbackIndependentOfTheTransaction.patch, AllMessagesAreAcknowledgedAndRolledbackIndependentOfTheTransaction.patch, allDTCImprovments.patch > > > When consuming messages in a transaction and sending new ones during processing of that message and the transaction is rolled back and commited on retry the number of published messages should be equal to the received one. > But the number of sent message is bigger than the number of received ones. This means some of the message sends are not rolled back others are. > EDIT: Further analysis have shown that the TransactionContext.TransactionId is null when sending eventhough a transaction is in progress and not yet completed. It must incorrectly be assigned to null somewhere. > The following application demonstrates the problem when enqueuing 100+ messages to foo.bar > class Program > { > private static INetTxSession activeMqSession; > private static IMessageConsumer consumer; > private static INetTxConnection connection; > static void Main(string[] args) > { > using (connection = CreateActiveMqConnection()) > using (activeMqSession = connection.CreateNetTxSession()) > using (consumer = activeMqSession.CreateConsumer(SessionUtil.GetQueue(activeMqSession, "queue://foo.bar"))) > { > connection.Start(); > while (true) > { > try > { > using (TransactionScope scoped = new TransactionScope(TransactionScopeOption.RequiresNew)) > { > IMessage msg = null; > while (msg == null) > { > msg = consumer.ReceiveNoWait(); > } > OnMessage(msg); > scoped.Complete(); > } > } > catch(Exception exception) {} > } > } > } > private static INetTxConnection CreateActiveMqConnection() > { > var connectionFactory = new Apache.NMS.ActiveMQ.NetTxConnectionFactory("activemq:tcp://localhost:61616") > { > AcknowledgementMode = AcknowledgementMode.Transactional > }; > return connectionFactory.CreateNetTxConnection(); > } > private static void OnMessage(IMessage message) > { > var x = new TestSinglePhaseCommit(); > Console.WriteLine("Processing message {0} in transaction {1} - {2}", message.NMSMessageId, Transaction.Current.TransactionInformation.LocalIdentifier, Transaction.Current.TransactionInformation.DistributedIdentifier); > var session2 = activeMqSession; > { > Transaction.Current.EnlistDurable(Guid.NewGuid(), x, EnlistmentOptions.None); > using (var producer = session2.CreateProducer(SessionUtil.GetQueue(session2, "queue://foo.baz"))) > { > producer.Send(new ActiveMQTextMessage("foo")); > } > if (!message.NMSRedelivered) throw new Exception(); > } > } > } > internal class TestSinglePhaseCommit : ISinglePhaseNotification > { > public void Prepare(PreparingEnlistment preparingEnlistment) > { > preparingEnlistment.Prepared(); > } > public void Commit(Enlistment enlistment) > { > enlistment.Done(); > } > public void Rollback(Enlistment enlistment) > { > enlistment.Done(); > } > public void InDoubt(Enlistment enlistment) > { > enlistment.Done(); > } > public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment) > { > singlePhaseEnlistment.Committed(); > } > } -- This message was sent by Atlassian JIRA (v6.1#6144)