2011-06-24 456 views
2

我正嘗試使用.NET MQ Extended Transaction Client與我們企業中的現有隊列管理器對話。我正在使用MQ 7.0.1試用版的擴展客戶端在乾淨安裝的Windows 2008 R2上運行。異常使用MQ Extendend Transaction Client寫入隊列

當我註釋掉TransactionScope和MQC.MQPMO_SYNCPOINT選項時,我的程序寫入隊列。隨着交易代碼我上q.Put()調用以下異常:

MQRC_UOW_ENLISTMENT_ERROR ReasonCode 2354 

這裏是我完整的程序:

using System; 
using System.Collections.Generic; 
using System.Text; 
using IBM.WMQ; 
using System.Transactions; 

namespace MQSeries 
{ 
class Program 
{ 
    static void Main(string[] args) 
    { 
     var transOptions = new TransactionOptions(); 
     transOptions.IsolationLevel = IsolationLevel.Serializable; 

     string queueManagerName = "MYQUEUEMANAGER"; 
     string queueName = "MYQUEUE"; 
     string channelName = "MYCHANNEL"; 
     string channelInfo = "myserver.com(1418)"; 

     MQQueueManager qm; 

     using (var trans = new TransactionScope(TransactionScopeOption.Required, transOptions, EnterpriseServicesInteropOption.Full)) 
     { 
      qm = new MQQueueManager(queueManagerName, channelName, channelInfo); 

      // Set up the options on the queue we wish to open 
      int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT; 

      var q = qm.AccessQueue(queueName, openOptions); 

      // Define a WebSphere MQ message, writing some text in UTF format 
      MQMessage hello_world = new MQMessage(); 
      hello_world.WriteUTF("Hello World!"); 

      // Specify the message options 
      MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the defaults, 
      pmo.Options = MQC.MQPMO_SYNCPOINT; 

      // Put the message on the queue 
      q.Put(hello_world, pmo); 
     } 

     qm.Disconnect(); 
    } 
} 
} 

注意,此計劃不具有trans.Complete( )電話。所以,除了當前的異常,我希望隊列中的消息被事務回滾。

回答

2

事實證明,這是v7客戶端中的一個公開問題。我V7 XA客戶正在和一個V6隊列管理器:

IC74808: MQ V7 XA CLIENT APPLICATION FAILS WHILE CONNECTING TO MQ V6 QUEUE MANAGER.

一個WebSphere MQ V7 XA客戶端應用程序 發出MQCONN到 的WebSphere MQ V6隊列管理器。 MQCONN在使用 原因碼2046,MQRC_OPTIONS_ERROR的xa_open期間失敗。 MSDTC進程 中的此故障導致UOW_ENLISTMENT_ERROR,其中 爲MQRC = 2354.這也導致 xa_open調用失敗,並且-3 (XAER_RMERR)。