2
votes

I am looking for some guidance regarding how to set up an application that listens to clustered queues on multiple queue managers. Below is our current setup:

Physical Box "Alpha": TCP listener defined for port: 1111 Queue Manager Name: QM1 Channel Name: "MyChannel" Queue Name: Q1

Physical Box "Beta": TCP Listener defined for port 1112 Queue Manager Name: QM2 Channel Name: "MyChannel" Queue Name: Q1

An external client application has a connection to QM1 on physical box Alpha on port 1111.

When I PUT messages onto Q1, because of the clustered setup, every second message is placed on either Q1 on QM1 or Q1 on QM2.

When another application is connected to QM2 on physical box Beta on port 1112, it receives only half the messages that have been sent to Q1 because it is not monitoring both queue managers.

Is there a way to connect to both queue managers so that my second application receives all messages that are placed on Q1 regardless of the Queue Manager that it is monitoring?

We are connecting via JMS using the following code:

 public static ConnectionFactory createConnectionFactory(final ConnectionString connectionString) throws JMSException {
        MQConnectionFactory cf = new MQConnectionFactory();
        cf.setHostName(connectionString.getHost());
        cf.setPort(connectionString.getPort());
        cf.setTransportType(WMQConstants.WMQ_CM_CLIENT);
                cf.setClientReconnectOptions(WMQConstants.WMQ_CLIENT_RECONNECT_Q_MGR);
        cf.setQueueManager(connectionString.getQueueManager());
        cf.setChannel(connectionString.getChannel());

        return cf;
    }
1
Some confusions with WMQ cluster here. When you define a WMQ cluster, you need to define a CLUSRCVR and a CLUSSDR for each queue manager. The transmission queue SYSTEM.CLUSTER.TRANSMIT.QUEUE will be automatically created. There is no way your application only receive half of the messages. Have you tested in real configurations?COLINHY
@COLINHY: We have tested in real configuration and there are CLUSRCVR and CLUSSDR channels defined on both boxes pointing to each other. Are you saying that an application connected to either QM1 or QM2 should receive all messages that are sent to Q1? Would this imply that the message is replicated across the queue Q1 on both QM1 and QM2?Maciej

1 Answers

3
votes

Applications must be locally connected to GET messages. The locally here means 'application can get messages from queues that are hosted in the queue manager to which the application is directly connected'. As the second application running Beta box is connected to queue manager QM2 where Q1 is hosted, it is getting messages.

Your can run another instance of your second application on Alpha box where the application connects to QM1 to get messages from Q1.

Update

Please note MQ cluster is for work loading balancing messages among multiple cluster queue instances in queue managers in a cluster. MQ cluster is not same as High Availability cluster. In MQ cluster messages will be distributed to all instances of a queue in a round robin basis( round robin distribution is the default. It can be changed to by developing cluster work load exit).

Since the job is to load balance messages, one application per cluster queue instance must be setup to process messages. If such a setup is not made, then messages will remain in cluster queue instances.