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 7089BDBDA for ; Sat, 27 Oct 2012 19:09:13 +0000 (UTC) Received: (qmail 82308 invoked by uid 500); 27 Oct 2012 19:09:13 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 82266 invoked by uid 500); 27 Oct 2012 19:09:13 -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 81938 invoked by uid 99); 27 Oct 2012 19:09:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Oct 2012 19:09:12 +0000 Date: Sat, 27 Oct 2012 19:09:12 +0000 (UTC) From: "Andrea Montemaggio (JIRA)" To: dev@activemq.apache.org Message-ID: <979714615.35439.1351364952765.JavaMail.jiratomcat@arcas> In-Reply-To: <397477284.30073.1351209912725.JavaMail.jiratomcat@arcas> Subject: [jira] [Updated] (AMQNET-398) NetTx transaction support in WCF binding 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-398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrea Montemaggio updated AMQNET-398: -------------------------------------- Attachment: Apache.NMS.WCF-NetTx.patch Apache.NMS.ActiveMQ-NetTx.patch > NetTx transaction support in WCF binding > ---------------------------------------- > > Key: AMQNET-398 > URL: https://issues.apache.org/jira/browse/AMQNET-398 > Project: ActiveMQ .Net > Issue Type: Improvement > Components: ActiveMQ, WCF > Reporter: Andrea Montemaggio > Assignee: Jim Gomes > Priority: Minor > Labels: transaction > Attachments: Apache.NMS.ActiveMQ-NetTx.patch, Apache.NMS.WCF-NetTx.patch > > > I needed to support ".NET style" distributed transactions with ActiveMQ broker and provided NMS WCF binding, but we can't get it working out of the box. > Because of WCF binding lacks explicit support for this scenario, I tried to fool it by supplying a wrapper for INetTxConnectionFactory (and a related one for INetTxConnection) as an IConnectionFactory through nmsprovider-*.config file. > Despite being able to make WCF binding to instantiate my wrapper class (and so, NetTxConnectionFactory under the hood), I needed to modify slightly WCF binding code in two points: > - NmsOutputChannel: here I noticed that a premature session disposing due to the using block caused a deadlock when the ISession implementation was NetTxSession who waits for transaction to complete (TransactionContext.DtcWaitHandle.WaitOne() in Close() method). This phenomenon was not evident in the provided test code, because of the TransactionScope block is always INSIDE the using block that scopes the session. Using WCF binding is somewhat higher level, so I'm forced to wrap the WCF call with a TransactionScope. > The modification I've made is to handle the non-transactional case like before, and to defer session disposing when inside a transaction (for this I've used provided events "TransactionCommittedListener" and "TransactionRolledBackListener"). > - NmsInputChannelListener: assuming a service method with OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true), my perception of the expected behavior when an exception is thrown in the service method is that the active transaction must be rolled back. Here we are on the receiving part (NMS WCF binding is below service code in the stack!) so > to ensure this behavior (I stress this here: it's the expected behavior for me), I've had to provide a WCF custom IErrorHandler to raise an exception in HandleError method, that NMS WCF binding could be catch and rollback the active transaction. > To obtain this, I've had to rethrow the exception in Dispatch method. I don't know if this cay cause troubles. > Morover, I discovered a bug in ActiveMQ provider NetTxConnection.GuidFromId: the implementation does not cares that the hyphen is a valid character hostnames. > I attach two patches here: one for the WCF binding component with the described changes, another for ActiveMQ provider with the transaction id translation fix and a minor one at a logging statement. > Best Regards, > Andrea Montemaggio -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira