PushCode
PushCode

Reputation: 1439

IBM MQ XMS error 2085 on CreateTopic

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)

Upvotes: 1

Views: 838

Answers (2)

JoshMc
JoshMc

Reputation: 10652

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.

Upvotes: 2

Shashi
Shashi

Reputation: 15273

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

Upvotes: 0

Related Questions