WebSphere MQ - Changing channel definition structure using XMS.NET API

拈花ヽ惹草 提交于 2019-12-04 02:24:05

问题


I am trying to set the MQCD structure properties - specifically HeartBeatInterval using XMS.NET API.

Background: I have client applications (in .NET) using XMS.NET API to read messages from WebSphere MQ. I use the ClientAcknowledge mode. If the client reads the message and does not ack it, WebSphere MQ waits for 300 seconds before timing out and makes (backout) the message available in the original queue for other clients to read the message.

Task: I want to lower the timeout from 300 seconds.

Our MQ Admin suggested to change the HearBeatInterval property on the channel. But changing it is making no difference.

Apparently, somehow setting the Channel's HeartBeatInterval property on client side (along with the server side channel setting) will make it work. I am attempting to set this value in the client application. But the XMS API does not have a property that corresponds to MQCD.HeartBeatInterval property

Any insight in accomplishing this task of lowering the message ack timeout? or even setting the HeartBeatInterval on the client side - if that's the way to do it.


回答1:


Certainly it is true that the actual negotiated value of heartbeat interval will takes the biggest number out of the client side and server side heartbeat values, I.e. will use the least frequent interval. If you want a shorter interval you will need to change both ends.

Rather than coding it in your application, why not use a CCDT? This is more flexible should you change you mind about the value to use and want to lower it or raise it in the future.

Further Reading

  1. Using a client channel definition table with .NET



回答2:


I think you can use the Disconnect interval(DISCINT) attribute of the server connection channel to terminate connections from applications that are hanging. By default DISCINT is set to 0 which means it's disabled. You can set a value that suits your requirement. Read more here: http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.ref.con.doc/q081860_.htm

Here is a sample snippet for using CCDT in XMS .NET application.

        // Get an instance of factory.
        factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);

        // Create WMQ Connection Factory.
        cf = factoryFactory.CreateConnectionFactory();

        // Use CCDT URL for client connection.
        cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "QM1");
        cf.SetStringProperty(XMSC.WMQ_CCDTURL, "file://C:\\ProgramData\\IBM\\MQ\\qmgrs\\QM1\\@ipcc\\AMQCLCHL.TAB");

        // Create connection.
        connectionWMQ = cf.CreateConnection();


来源:https://stackoverflow.com/questions/26142127/websphere-mq-changing-channel-definition-structure-using-xms-net-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!