1

I am trying to Create a topic and publish a message to IBM MQ topic. I am getting the 2085 MQ exception and sure how to resolve this.
IBM.XMS.dll version I am using is 8.0.0.6.

Console app code:

    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();
        }

    }

Exception Details:

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)

PushCode
  • 1,419
  • 3
  • 15
  • 31

2 Answers2

2

Ensure that your SVRCONN channel has a SHARECNV value of 1 or higher.

IBM MQ v8 Knowledge center page "MQI client: Default behavior of client-connection and server-connection channels" documents the following about 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.

The IBM MQ v8 Knowledge center page "XMSC_WMQ_PROVIDER_VERSION" documents the following:

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.

That would cause XMS to attempt to use the STREAM queue to publish messages with queued publish/subscribe. Set it to 1 or higher to get a v7 style connection and use normal v7 integrated publish/subscribe.

In some past versions setting SHARECNV(0) was a work around for certain problems, I don't know of any v8 problems that have this work around.

JoshMc
  • 10,239
  • 2
  • 19
  • 38
  • On my Channel, `Shared conversation` property is set to `0` – PushCode Jul 16 '17 at 01:15
  • 1
    That is the problem. `SHARECNV(0)` force a `v6` type connection. That would cause XMS to attempt to use the STREAM queue to publish messages. Set it to 1 or higher. In some past versions setting it to 0 was a work around for certain problems, I don't know of any v8 problems that have this work around. – JoshMc Jul 16 '17 at 01:20
0

The syntax for specifying topic destination must begin with "topic://". For example session.CreateTopic("topic://Score/Football"). Please see documentation here for more details.

Shashi
  • 14,980
  • 2
  • 33
  • 52
  • 2085 means Unknown object. Am surprised a 2085 is thrown for a topic. Can you show us updated code where you have made the change? – Shashi Jul 16 '17 at 00:41
  • Code updated in main question: `IDestination destination = session.CreateTopic("topic://TOPIC/NAME"); // destinationName – PushCode Jul 16 '17 at 00:48
  • I think I understand the issue here. Somehow your application is hitting queued pubsub code path, exception shows reference to MQ v6. There is connection factory property to set "provider version". Can you please read about that property and set a value so as to use MQ v7 code path? – Shashi Jul 16 '17 at 00:52
  • See this link: https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_8.0.0/com.ibm.mq.msc.doc/xmsc_wmq_provider_version.htm. Check your Windows GAC for any other version of XMS and MQ .net installations. – Shashi Jul 16 '17 at 01:03
  • I added the following property `connectionFactory.SetStringProperty(XMSC.WMQ_PROVIDER_VERSION, "7.0.0.0");` I get other error about version miss match. Error: The sharing conversations channel value 7.0.0.0 is not supported for the requested provider version 0 The value specified for the sharing conversations channel property is not supported by the requested queue manager Provider Version. An 'unspecified' Provider Version will attempt a Normal Mode connection. – PushCode Jul 16 '17 at 01:06
  • I think it needs to be just "7". – Shashi Jul 16 '17 at 01:09
  • I think this should be set to simply `7`, not `7.0.0.0`. – JoshMc Jul 16 '17 at 01:09
  • Did you check GAC? – Shashi Jul 16 '17 at 01:13
  • I have both 8.0.0.0 and 8.0.0.6 versions in my GAC. But, on my server, I have only 8.0.0.6 in GAC. I have the same issue on my server as well. – PushCode Jul 16 '17 at 01:22