How do you connect to a Multi-Instance Queue Manager using MQQueueConnectionFactory

ぐ巨炮叔叔 提交于 2019-12-05 00:25:13

问题


We have an application which needs to communicate with a Multi-Instance QueueManager. Both (instances) are running on the default port and have unique addresses.

  • serverA.internal.company.address
  • serverB.internal.company.address

We use the following code to establish the ConnectionFactory:

MQQueueConnectionFactory connectionFactory = new MQQueueConnectionFactory();
connectionFactory.setTransportType(1);
connectionFactory.setPort(1414);
connectionFactory.setChannel("CLIENTCONNECTION");
connectionFactory.setQueueManager("queue.manager.name.here");
connectionFactory.setHostName("serverA.internal.company.address");

How can we specify both addresses so that failover is achieved without writing our own retry logic?


回答1:


using the following:

connectionFactory.setConnectionNameList("serverA.internal.company.address(1414),"
                                      + "serverB.internal.company.address(1414)")

instead of

connectionFactory.setHostName("serverA.internal.company.address");
connectionFactory.setPort(1414);

did the trick for us.




回答2:


You are on exactly the correct track - but please do review this technote for information.

http://www-01.ibm.com/support/docview.wss?uid=swg21508357



来源:https://stackoverflow.com/questions/20010066/how-do-you-connect-to-a-multi-instance-queue-manager-using-mqqueueconnectionfact

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