10 min read

(For more resources on IBM, see here.)

After reading this article, you will not be a WebSphere MQ expert, but you will have brought your knowledge of MQ to a level where you can have a sensible conversation with your site’s MQ administrator about what the Q replication requirements are.

IBM WebSphere MQ commands

An introduction to MQ

In a nutshell, WebSphere MQ is an assured delivery mechanism, which consists of queues managed by Queue Managers. We can put messages onto, and retrieve messages from queues, and the movement of messages between queues is facilitated by components called Channels and Transmission Queues.

There are a number of fundamental points that we need to know about WebSphere MQ:

  • All objects in WebSphere MQ are case sensitive
  • We cannot read messages from a Remote Queue (only from a Local Queue)
  • We can only put a message onto a Local Queue (not a Remote Queue)

It does not matter at this stage if you do not understand the above points, all will become clear in the following sections.

There are some standards regarding WebSphere MQ object names:

  • Queue names, processes and Queue Manager names can have a maximum length of 48 characters
  • Channel names can have a maximum length of 20 characters
  • The following characters are allowed in names: A-Z,a-z,0-9, and . / _ % symbols
  • There is no implied structure in a name — dots are there for readability

Now let’s move on to look at MQ queues in a little more detail.

MQ queues

MQ queues can be thought of as conduits to transport messages between Queue Managers.

There are four different types of MQ queues and one related object. The four different types of queues are: Local Queue (QL), Remote Queue (QR), Transmission Queue (TQ), and Dead Letter Queue, and the related object is a Channel (CH).

One of the fundamental processes of WebSphere MQ is the ability to move messages between Queue Managers. Let’s take a high-level look at how messages are moved, as shown in the following diagram:

IBM WebSphere MQ commands

When the application Appl1 wants to send a message to application Appl2, it opens a queue – the local Queue Manager (QM1) determines if it is a Local Queue or a Remote Queue. When Appl1 issues an MQPUT command to put a message onto the queue, then if the queue is local, the Queue Manager puts the message directly onto that queue. If the queue is a Remote Queue, then the Queue Manager puts the message onto a Transmission Queue.

The Transmission Queue sends the message using the Sender Channel on QM1 to the Receiver Channel on the remote Queue Manager (QM2). The Receiver Channel puts the message onto a Local Queue on QM2. Appl2 issues a MQGET command to retrieve the message from this queue.

Now let’s move on to look at the queues used by Q replication and in particular, unidirectional replication, as shown in the following diagram. What we want to show here is the relationship between Remote Queues, Transmission Queues, Channels, and Local Queues. As an example, let’s look at the path a message will take from Q Capture on QMA to Q Apply on QMB.

(Move the mouse over the image to enlarge.)

Note that in this diagram the Listeners are not shown.

Q Capture puts the message onto a remotely-defned queue on QMA (the local Queue Manager for Q Capture). This Remote Queue (CAPA.TO.APPB.SENDQ.REMOTE) is effectively a “place holder” and points to a Local Queue (CAPA.TO.APPB.RECVQ) on QMB and specifes the Transmission Queue (QMB.XMITQ) it should use to get there. The Transmission Queue has, as part of its defnition, the Channel (QMA.TO.QMB) to use. The Channel QMA.TO.QMB has, as part of its defnition, the IP address and Listening port number of the remote Queue Manager (note that we do not name the remote Queue Manager in this defnition—it is specifed in the defnition for the Remote Queue).

The defnition for unidirectional Replication Queue Map (circled queue names) is:

SENDQ: CAPA.TO.APPB.SENDQ.REMOTE on the source

RECVQ: CAPA.TO.APPB.RECVQ on the target

ADMINQ: CAPA.ADMINQ.REMOTE on the target

Let’s look at the Remote Queue defnition for CAPA.TO.APPB.SENDQ.REMOTE, shown next. On the left-hand side are the defnitions on QMA, which comprise the Remote Queue, the Transmission Queue, and the Channel defnition. The defnitions on QMB are on the right-hand side and comprise the Local Queue and the Receiver Channel.

IBM WebSphere MQ commands

Let’s break down these defnitions to the core values to show the relationship between the different parameters, as shown next:

We defne a Remote Queue by matching up the superscript numbers in the defnitions in the two Queue Managers:

For defnitions on QMA, QMA is the local system and QMB is the remote system.

For defnitions on QMB, QMB is the local system and QMA is the remote system.

  1. Remote Queue Manager name
  2. Name of the queue on the remote system
  3. Transmission Queue name
  4. Port number that the remote system is listening on
  5. The IP address of the Remote Queue Manager
  6. Local Queue Manager name
  7. Channel name

Queue names:

  • QMB: Decide on the Local Queue name on QMB—CAPA.TO.APPB.RECVQ.
  • QMA: Decide on the Remote Queue name on QMB—CAPA.TO.APPB.SENDQ.REMOTE.

Channels:

  • QMB: Defne a Receiver Channel on QMB, QMA.TO.QMB—make sure the channel type (CHLTYPE) is RCVR.
  • The Channel names on QMA and QMB have to match: QMA.TO.QMB.
  • QMA: Defne a Sender Channel, which takes the messages from the Transmission Queue QMB.XMITQ and which points to the IP address and Listening port number of QMB. The Sender Channel name must be QMA.TO.QMB.

Let’s move on from unidirectional replication to bidirectional replication. The bidirectional queue diagram is shown next, which is a cut-down version of the full diagram of the The WebSphere MQ layer and just shows the queue names and types without the details.

The principles in bidirectional replication are the same as for unidirectional replication. There are two Replication Queue Maps—one going from QMA to QMB (as unidirectional replication) and one going from QMB to QMA.

MQ queue naming standards

The naming of the WebSphere MQ queues is an important part of Q replication setup. It may be that your site already has a naming standard for MQ queues, but if it does not, then here are some thoughts on the subject (WebSphere MQ naming standards were discussed in the Introduction to MQ section):

Queues are related to Q Capture and Q Apply programs, so it would be useful to have that fact refected in the name of the queues.

  • A Q Capture needs a local Restart Queue and we use the name CAPA.RESTARTQ.
  • Each Queue Manager can have a Dead Letter Queue. We use the prefx DEAD.LETTER.QUEUE with a suffx of the Queue Manager name giving DEAD.LETTER.QUEUE.QMA.
  • Receive Queues are related to Send Queues.
    For every Send Queue, we need a Receive Queue. Our Send Queue names are made up of where they are coming from, Q Capture on QMA (CAPA), and where they are going to, Q Apply on QMB (APPB), and we also want to put in that it is a Send Queue and that it is a remote defnition, so we end up with CAPA.TO.APPB.SENDQ.REMOTE. The corresponding Receive Queue will be called CAPA.TO.APPB.RECVQ.
  • Transmission Queues should refect the names of the “to” Queue Manager.
    Our Transmission Queue on QMA is called QMB.XMITQ, refecting the Queue Manager that it is going to, and that it is a Transmission Queue. Using this naming convention on QMB, the Transmission Queue is called QMA.XMITQ.
  • Channels should refect the names of the “from” and “to” Queue Managers.
    Our Sender Channel defnition on QMA is QMA.TO.QMB refecting that it is a channel from QMA to QMB and the Receiver Channel on QMB is also called QMA.TO.QMB. The Receiver Queue on QMA is called QMB.TO.QMA for a Sender Channel of the same name on QMB.
  • A Replication Queue Map defnition requires a local Send Queue, and a remote Receive Queue and a remote Administration Queue.
    The Send Queue is the queue that Q Capture writes to, the Receive Queue is the queue that Q Apply reads from, and the Administration Queue is the queue that Q Apply writes messages back to Q Capture with.

MQ queues required for different scenarios

This section lists the number of Local and Remote Queues and Channels that are needed for each type of replication scenario.

The queues and channels required for unidirectional replication (including replicating to a Stored Procedure) and Event Publishing are shown in the following tables. Note that the queues and channels required for Event Publishing are a subset of those required for unidirectional replication, but creating extra queues and not using them is not a problem.

The queues and channels required for unidirectional (including replicating to a Stored Procedure) are shown in the following table:

QMA (7)

QMB (7)

3 Local Queues:

CAPA.ADMINQ

CAPA.RESTARTQ

DEAD.LETTER.QUEUE.QMA

1 Remote Queue:

CAPA.TO.APPB.SENDQ.REMOTE

1 Transmission Queue:

QMB.XMITQ

1 Sender Channel:

QMA.TO.QMB

1 Receiver Channel:

QMB.TO.QMA

2 Local Queues:

CAPA.TO.APPB.REVCQ

DEAD.LETTER.QUEUE.QMB

1 Remote Queue:

CAPA.ADMINQ.REMOTE

1 Transmission Queue:

QMA.XMITQ

1 Sender Channel:

QMB.TO.QMA

1 Receiver Channel:

QMA.TO.QMB

1 Model Queue:

IBMQREP.SPILL.MODELQ

 

The queues required for Event Publishing are shown in the following table:

QMA (7)

QMB (7)

3 Local Queues:

CAPA.ADMINQ

CAPA.RESTARTQ

DEAD.LETTER.QUEUE.QMA

1 Remote Queue:

CAPA.TO.APPB.SENDQ.REMOTE

1 Transmission Queue:

QMB.XMITQ

1 Sender Channel:

QMA.TO.QMB

1 Receiver Channel:

QMB.TO.QMA

2 Local Queues:

CAPA.TO.APPB.REVCQ

DEAD.LETTER.QUEUE.QMB

1 Receiver Channel:

QMA.TO.QMB

The queues and channels required for bidirectional/P2P two-way replication are shown in the following table:

QMA (10)

QMB (10)

4 Local Queues:

CAPA.ADMINQ

CAPA.RESTARTQ

DEAD.LETTER.QUEUE.QMA

CAPB.TO.APPA.RECVQ

2 Remote Queues:

CAPA.TO.APPB.SENDQ.REMOTE

CAPB.ADMINQ.REMOTE

1 Transmission Queue:

QMB.XMITQ

1 Sender Channel:

QMA.TO.QMB

1 Receiver Channel:

QMB.TO.QMA

1 Model Queue:

IBMQREP.SPILL.MODELQ

4 Local Queues:

CAPB.ADMINQ

CAPB.RESTARTQ

DEAD.LETTER.QUEUE.QMB

CAPA.TO.APPB.RECVQ

2 Remote Queues:

CAPB.TO.APPA.SENDQ.REMOTE

CAPA.ADMINQ.REMOTE

1 Transmission Queue:

QMA.XMITQ

1 Sender Channel:

QMB.TO.QMA

1 Receiver Channel:

QMA.TO.QMB

1 Model Queue:

IBMQREP.SPILL.MODELQ

The queues and channels required for P2P three-way replication are shown in the following table:

QMA (16)

QMB (16)

QMC (16)

5 Local Queues:

CAPA.ADMINQ

CAPA.RESTARTQ

DEAD.LETTER.QUEUE. QMA

CAPB.TO.APPA.RECVQ

CAPC.TO.APPA.RECVQ

4 Remote Queues:

CAPA.TO.APPB. SENDQ.REMOTE

CAPB.ADMINQ.REMOTE

CAPA.TO.APPC. SENDQ.REMOTE

CAPC.ADMINQ.REMOTE

2 Transmission Queues:

QMB.XMITQ

QMC.XMITQ

2 Sender Channels:

QMA.TO.QMC

QMA.TO.QMB

2 Receiver Channels:

QMC.TO.QMA

QMB.TO.QMA

1 Model Queue:

IBMQREP.SPILL. MODELQ

5 Local Queues:

CAPB.ADMINQ

CAPB.RESTARTQ

DEAD.LETTER.QUEUE. QMB

CAPA.TO.APPB.RECVQ

CAPC.TO.APPB.RECVQ

4 Remote Queues:

CAPB.TO.APPA. SENDQ.REMOTE

CAPA.ADMINQ.REMOTE

CAPB.TO.APPC. SENDQ.REMOTE

CAPC.ADMINQ.REMOTE

2 Transmission Queues:

QMA.XMITQ

QMC.XMITQ

2 Sender Channels:

QMB.TO.QMA

QMB.TO.QMC

2 Receiver Channels:

QMA.TO.QMB

QMC.TO.QMB

1 Model Queue:

IBMQREP.SPILL. MODELQ

5 Local Queues:

CAPC.ADMINQ

CAPC.RESTARTQ

DEAD.LETTER. QUEUE.QMC

CAPA.TO.APPC.RECVQ

CAPB.TO.APPC.RECVQ

4 Remote Queues:

CAPC.TO.APPA. SENDQ.REMOTE

CAPA.ADMINQ.REMOTE

CAPC.TO.APPB. SENDQ.REMOTE

CAPB.ADMINQ.REMOTE

2 Transmission Queues:

QMA.XMITQ

QMB.XMITQ

2 Sender Channels:

QMC.TO.QMA

QMC.TO.QMB

2 Receiver Channels:

QMA.TO.QMC

QMB.TO.QMC

1 Model Queue:

IBMQREP.SPILL. MODELQ

LEAVE A REPLY

Please enter your comment!
Please enter your name here