2017-07-15 323 views
1

我正在嘗試創建主題並將消息發佈到IBM MQ主題。我正在獲取2085 MQ異常,並確定如何解決此問題。
我使用的IBM.XMS.dll版本是8.0.0.6。CreateTopic上的IBM MQ XMS錯誤2085

控制檯應用程序代碼:

static void Main(string[] args) 
    { 
     try 
     { 
      XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); 

      IConnectionFactory connectionFactory = factoryFactory.CreateConnectionFactory(); 
      Console.WriteLine("Connection Factory created."); 

      connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "MQ_TX_MGR"); 
      connectionFactory.SetStringProperty(XMSC.WMQ_CONNECTION_NAME_LIST, "10.10.10.10(1414)"); 
      connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, "CL.SVRCONN"); 

      connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); 
      connectionFactory.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_OPTIONS, XMSC.WMQ_CLIENT_RECONNECT); 
      connectionFactory.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT, 3); 

      mqConnection = connectionFactory.CreateConnection(); 
      Console.WriteLine("Connection created."); 

      session = mqConnection.CreateSession(false, AcknowledgeMode.AutoAcknowledge); 
      Console.WriteLine("Session created."); 


      IDestination destination = session.CreateTopic("topic://TOPIC/NAME"); // destinationName 
      Console.WriteLine("Destination created."); 

      // create producer 
      IMessageProducer producer = session.CreateProducer(destination); //My Code is erroring out at this line. 

     } 
     catch (Exception ex) 
     { 
      Console.WriteLine(ex.Message); 
     } 
     finally 
     { 
      Console.WriteLine("Program waiting for message:"); 
      Console.ReadLine(); 
     } 

    } 

異常詳細信息:

Error Message:
CWSMQ0006E: An exception was received during the call to the method WmqV6Session.SetupPubSub: CompCode: 2, Reason: 2085. During execution of the specified method an exception was thrown by another component. See the linked exception for more information.

Linked Exception Reason: 2085

Linked Exception Stack Trace:
at IBM.WMQ.MQDestination.Open(MQObjectDescriptor& od) at IBM.WMQ.MQQueue..ctor(MQQueueManager qMgr, String queueName, Int32 openOptions, String queueManagerName, String dynamicQueueName, String alternateUserId) at IBM.WMQ.MQQueueManager.AccessQueue(String queueName, Int32 openOptions, String queueManagerName, String dynamicQueueName, String alternateUserId) at IBM.WMQ.MQQueueManager.AccessQueue(String queueName, Int32 openOptions) at IBM.XMS.Client.WMQ.MqV6Impl.WmqV6Session.SetUpPubSub(Boolean startCleanup)

+0

什麼版本的MQ是來自連接到的隊列管理器上的'IBM.XMS.dll',以及正在運行的MQ版本? – JoshMc

+0

@JoshMc客戶端和服務器都有8.0.06 – PushCode

+0

您可以檢查SVRCONN通道上的SHARECNV值嗎? – JoshMc

回答

2

確保您的SVRCONN頻道的SHARECNV值等於或大於1。

IBM MQ V8知識中心頁面 「MQI client: Default behavior of client-connection and server-connection channels」 記錄了以下有關SHARECNV(0)

This value specifies no sharing of conversations over a TCP/IP socket. The channel instance behaves exactly as if it was a Version 6.0 server or client connection channel, and you do not get the extra features such as bi-directional heartbeats that are available when you set SHARECNV to 1 or greater. Only use a value of 0 if you have existing client applications that do not run correctly when you set SHARECNV to 1 or greater.

IBM的MQ V8知識中心頁面 「XMSC_WMQ_PROVIDER_VERSION」 記載了以下內容:

By default this property is set to "unspecified".

...

IBM WebSphere MQ Version 7.0 specific features are disabled if XMSC_WMQ_PROVIDER_VERSION is set to UNSPECIFIED and SHARECNV is set to 0.

這將導致XMS嘗試使用STREAM隊列發佈排隊發佈/訂閱的消息。將其設置爲1或更高可獲得v7風格的連接,並使用普通的v7集成發佈/訂閱。

在以前的某些版本中,設置SHARECNV(0)是解決某些問題的方法,我不知道有任何v8問題可以解決此問題。

+0

在我的頻道上,「Shared conversation」屬性設置爲「0」 – PushCode

+1

這就是問題所在。 'SHARECNV(0)'強制一個'v6'類型的連接。這會導致XMS嘗試使用STREAM隊列發佈消息。將其設置爲1或更高。在過去的一些版本中,將其設置爲0是解決某些問題的方法,我不知道有任何v8問題可以解決此問題。 – JoshMc

+0

更改設置的工作。謝謝JoshMc – PushCode

0

指定主題目標必須以 「主題://」 開頭的語法。例如session.CreateTopic("topic://Score/Football")。有關更多詳細信息,請參閱文檔 here

+0

我甚至嘗試過。相同的錯誤 – PushCode

+0

2085表示未知對象。我驚訝地發現2085年是一個話題。你能向我們展示更新後的代碼嗎? – Shashi

+0

代碼在主要問題中更新:'IDestination destination = session.CreateTopic(「topic:// TOPIC/NAME」); // destinationName – PushCode