问题
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
回答1:
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.
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
来源:https://stackoverflow.com/questions/56370312/ibm-mq-how-to-connect-to-queue-manager-with-multiple-connections-names-one-i