Connecting to the MQ Server using CCDT

后端 未结 1 1995
攒了一身酷
攒了一身酷 2021-01-28 09:35

I\'m trying to connect to the MQ using the information present in the CCDT file. I can currently connect to the MQ using all the details,

相关标签:
1条回答
  • 2021-01-28 09:52

    You will need to set MQCHLLIB and MQCHLTAB environment variables to use CCDT. You can set these two variables either from command prompt,app.config or code in the application itself.

    Following example demonstrates usage of CCDT:

            MQQueueManager qm = null;
            System.Environment.SetEnvironmentVariable("MQCHLLIB", "C:\\ProgramData\\IBM\\MQ\\qmgrs\\QM1\\@ipcc");
            System.Environment.SetEnvironmentVariable("MQCHLTAB", "AMQCLCHL.TAB");
    
            try
            {
                **Hashtable props = new Hashtable();
                props.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
                qm = new MQQueueManager("QM1",props);**
                MQQueue queue1 = qm.AccessQueue("SYSTEM.DEFAULT.LOCAL.QUEUE", MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING);
                MQMessage msg = new MQMessage();
                msg.WriteUTF("Hello this message is from .net client");
                queue1.Put(msg);
                queue1.Close();
                qm.Disconnect();
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
    
    0 讨论(0)
提交回复
热议问题