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.
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?
To connect MQ Explorer to a queue manager: In the Navigator view, right-click the queue manager, then click Connect or Disconnect. MQ Explorer connects or disconnects the queue manager. The color of the queue manager's icon changes to yellow when connected, or gray when disconnected.
To run a multi-instance queue manager, start the queue manager on one of the servers using the strmqm -x QM1 command; the -x option permits the instance to failover. It becomes the active instance.
A multi-instance queue manager is one part of a high availability solution. You need some additional components to build a useful high availability solution. Client and channel reconnection to transfer IBM MQ connections to the computer that takes over running the active queue manager instance.
To start a queue manager by using the IBM MQ Explorer, complete the following steps: Open the IBM MQ Explorer. In the Navigator view, select the queue manager. Click Start.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With