0

When using any of the language bindings based on MQI it's possible to define a connection string with multiple host / ports and the MQI Client layer will attempt to connect to each in turn, returning the first connection made.

eg. in Python this would look something like, please excuse the hard-coded values:

import pymqi

queue_manager = 'QM1'
channel = 'DEV.APP.SVRCONN'

conn_alpha = '%s(%s)' % ('192.168.0.61', '1414')
conn_beta = '%s(%s)' % ('192.168.0.71', '1414')

conn_info = "%s,%s" % (conn_alpha, conn_beta)

qmgr = pymqi.connect(queue_manager, channel, conn_info)

Is there an equivalent mechanism in C# XMS. I have


factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);

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

// Set the properties
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "192.168.0.61");
cf.SetIntProperty(XMSC.WMQ_PORT, 1414);

...

Is there a way to add in the second host / port as properties into the connection attempt?

JoshMc
  • 10,239
  • 2
  • 19
  • 38
chughts
  • 4,210
  • 2
  • 14
  • 27
  • You work for IBM please use the right tag [ibm-mq]. – JoshMc Nov 14 '19 at 13:14
  • Should be `cf.SetStringProperty(XMSC.WMQ_CONNECTION_NAME_LIST, "192.168.0.61(1414),192.168.0.71(1414)");`. If that works I'll put it in a quick answer. – JoshMc Nov 14 '19 at 13:26
  • Setting the string property `XMSC.WMQ_CONNECTION_NAME_LIST` works, but it does take 3 minutes for the connect to fail on the 1st connection, before it tries the second. Setting the int properties `XMSC.WMQ_CLIENT_RECONNECT_OPTIONS` and `XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT` don't appear to make a difference. – chughts Nov 14 '19 at 16:58
  • Thai is related to connect timeout. What do you see with python running on the same server? – JoshMc Nov 14 '19 at 17:55
  • For the Python code it's the same 3 minutes. It's a minor niggle in testing the functionality, 3 mins to switch to the secondary server if the primary is not available. – chughts Nov 15 '19 at 11:13
  • For python you can set connecttimeout in the qm.ini TCP stanza to tune the number down. If you are using unmanaged XMS.NET it will also use the qm.ini value. If you are using Managed XMS.NET then I am not sure how to tune it but know the docs state connecttimeout is not used. – JoshMc Nov 15 '19 at 11:35
  • You can test quicker by pointing to a IP that is up but a port that is not, this will fail quickly. – JoshMc Nov 15 '19 at 11:36

0 Answers0