Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 480
Randyaa Avatar asked Nov 15 '13 20:11

Randyaa


People also ask

How do I connect to queue manager?

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.

How do I start a multi-instance queue manager?

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.

What is MQ multi-instance queue manager?

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.

How do I start the IBM MQ queue Manager?

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.


2 Answers

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

like image 28
Calanais Avatar answered Oct 22 '22 05:10

Calanais


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.

like image 100
Randyaa Avatar answered Oct 22 '22 03:10

Randyaa