使用基于MQI的任何语言绑定时,可以定义具有多个主机/端口的连接字符串,并且MQI客户端层将尝试依次连接到每个主机/端口,并返回建立的第一个连接。
例如在Python中,看起来像这样,请原谅硬编码的值:
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)
C#XMS中是否存在等效的机制。我有
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);
...
是否可以将第二个主机/端口作为属性添加到连接尝试中?