IBM MQ - how to connect to Queue manager with multiple connections names ( one is fail over)

时光毁灭记忆、已成空白 提交于 2019-12-24 01:24:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!