IBM MQ-如何使用多个连接名称连接到队列管理器(一个已故障转移)

IBM MQ-如何使用多个连接名称连接到队列管理器(一个已故障转移)

问题描述:

我对IBM MQ来说是个新手.我的是一个多实例队列管理器.

I am quite new to IBM MQ's. Mine is a multi-instance queue manager.

一个实例就像是故障转移.

One instance is like fail-over.

即使其中之一发生故障,如何连接它们.

How can I connect to them even if one of is down.

我不确定我的术语是否正确?

I am not sure whether my terminology is right or not?

我现在尝试使用下面的示例进行连接

I am trying to connect using below example now

https://raw .githubusercontent.com/ibm-messaging/mq-dev-samples/master/gettingStarted/jms/JmsPutGet.java

不是用host1(port1),host2(port2)格式的逗号分隔列表来填充WMQ_HOST_NAMEWMQ_PORT而是填充WMQ_CONNECTION_NAME_LIST. IBM MQ将首先尝试连接到host1,如果失败,它将在初始连接尝试期间尝试host2.

Instead of populating WMQ_HOST_NAME and WMQ_PORT populate WMQ_CONNECTION_NAME_LIST with a comma separated list that is in the format host1(port1),host2(port2). IBM MQ will attempt to connect to host1 first and if it fails it will attempt host2 during the initial connection attempt.

如果您希望客户端在发生故障时重新连接,则需要启用mq自动重新连接,如下所示:

If you want the client to reconnect on failure you will need to enable mq auto reconnect like this:

cf.setClientReconnectOptions(WMQConstants.WMQ_CLIENT_RECONNECT);
cf.setClientReconnectTimeout(1800); // how long in seconds to continue to attempt reconnection before failing