简体   繁体   中英

IBM MQ XMS.NET client reconnect timeout can't be changed

IBM MQ has an automatic client renonnect functionality, and it has a default timeout of 30 minutes. After 30 minutes it stops trying to reconnect ( source - p35 ).

I want to change the timeout so it lasts a longer time retrying (for example 2 hours). I suppose I can use the property XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT for this because it's available in the XMSC class.

Testing

I can simulate a connection failure by blocking the port 1414 where the client application makes connection to IBM MQ. And for testing purposes, I lower the timeout value to 5 minutes (instead of 30 minutes).

What I can see in the logging is that the client application receives XMSException with reason code 2544 (reconnecting):

IBM.XMS.XMSException: MQ delivered an asynchronous event with completion code 1, and reason 2544.
XMSWMQ2014.explanation
XMSWMQ2014.useraction

Linked Exception : CompCode: 1, Reason: 2544

This occurs for 30 minutes, and after that, I get an XMSException with reason code 2009 (connection broken). And auto reconnect fails.

XMSException occurred: IBM.XMS.XMSException: MQ delivered an asynchronous event with completion code 2, and reason 2009.
XMSWMQ2014.explanation
XMSWMQ2014.useraction

Linked Exception : CompCode: 2, Reason: 2009

I can conclude that changing the timeout value has no effect... Am I configuring the reconnect timeout in a wrong way?

Below, there is a code snippet:

XMSFactoryFactory factory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
IConnectionFactory connectionFactory = factory.CreateConnectionFactory();
connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, "hostname");
connectionFactory.SetIntProperty(XMSC.WMQ_PORT, 1414);
connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, "channel_name");
connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED);
connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "*");
connectionFactory.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_OPTIONS, XMSC.WMQ_CLIENT_RECONNECT_Q_MGR);
connectionFactory.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT, 300); //300 seconds = 5 minutes

IConnection conn = connectionFactory.CreateConnection();
conn.Start();

IBM MQ Client version: 8.0.0.5

Notes

I've found a way to accomplish this, but unfortunately not by code...

The reconnect timeout can be set in mqclient.ini .

Example:

CHANNELS:
MQReconnectTimeout = 14400

With this configuration applied, the client application should keep retrying for 4 hours.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM