6

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?

Morag Hughson
  • 7,255
  • 15
  • 44
Randyaa
  • 2,935
  • 4
  • 36
  • 49
  • I found someone with a very similar issue (http://www.mqseries.net/phpBB2/viewtopic.php?t=57240&sid=02cc89b38c7795d2571155e1e3866aa5) on mqseries.net but their solution does not seem like it is applicable. – Randyaa Nov 15 '13 at 20:33
  • connectionFactory.setConnectionNameList(string) might do the trick. I'm going to investigate. – Randyaa Nov 15 '13 at 20:46
  • a similar question was asked at http://stackoverflow.com/questions/12975618/mqqueuemanager-multiple-instance-in-java – Randyaa Nov 15 '13 at 20:57

2 Answers2

10

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.

Randyaa
  • 2,935
  • 4
  • 36
  • 49
5

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

Calanais
  • 1,541
  • 9
  • 10