IBM MQ Basics

0 Comments

 "Last updated on Dec 25, 2021"

IBM MQ is one of the major market players in Message Oriented Middleware Technologies. Here in this post, I have tried to give some important questions and their answers.

1) What is IBM MQ?

Message Queuing is a technology used to send and receive messages between different applications and platforms. IBM MQ is a Message Queuing product from IBM.

2) How to install MQ in Linux/Unix server?

Below are steps to install IBM MQ 9.2. MQ 9.2 can be installed in a 64-bit Linux® system and needs root access to install

  • Login/switch as root on the Linux server
  • Run "./mqlicense.sh -text_only"
  • Use "rpm -ivh MQSeriesRuntime-.rpm MQSeriesServer-.rpm" (To install runtime and server components) or "rpm -ivh MQSeries*.rpm" (To install all components) to install MQ in default location

Note: If you have another MQ version already installed, you have to use "crtmqpkg" to set the path location before installing. For more details, refer "https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.2.0/com.ibm.mq.ins.doc/q009010_.htm"

3) How to create a Queue Manager with parameters?

To create a QM with Circular logging, run 'crtmqm -c "Descriptive text" -u "DLQ" -lc -ld "LogPath" -lf "LogFilePages" QM_Name'

To create a QM with Linear logging, run 'crtmqm -c "Descriptive text" -u "DLQ" -ll -lp "Primary log count" -ls "Secondary log count" -ld "LogPath" -lf "LogFilePages" QM_Name'

Parameter details:
  • c - Descriptive text about QM
  • u - Dead Letter Queue name
  • lc - To create the QM with Circular Logging
  • ll - To create the QM with Linear Logging
  • lp - Number of Primary log files (Minimum is 2 and System Default is 3 if not mentioned)
  • ls - Number of Secondary log files (Minimum and System Default is 2)
  • ld - The path in which the log files should be stored
  • lf - the number of the log file pages (minimum is 64 and System default is 4096)

For more details "https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_8.0.0/com.ibm.mq.ref.adm.doc/q083120_.htm"

4) What is a distributed queuing environment?

Distributed Queuing Environment is, configuring queue managers to send and receive message between them to avoid creating multiple channels between each and every application to queue managers. It reduces the complexity in creating communication between applications.

5) What are the types of Queues available in MQ?

  • Local Queue - Queues which are local to a QM and can be used to store messages
  • Remote Queue Definitions - Queue definitions which are used to send messages to a a local queue in another Queue Manager
  • Transmit Queues(XMITQs) - A type of Local queue which is used to send messages to a remote Queue Manager
  • Alias Queues - An alias which is used to point another queue or topic. It cannot store any message.
  • Model Queue - Model queue is a template which contains queue definition. It will be used to create dynamic queues.
  • Dynamic Queues - Queues created dynamically upon request from application. It can be temporary or permanent queue.

6) How to create a local queue?

define qlocal("Q_Name") maxdepth("maximum capacity of the queue") maxmsgl("Maximum message length") defpsist(Yes/No) descr("description of the queue")

7) How to create a Remote Queue Definition?

define qremote("Q_Name") XMITQ("Transmit queue name") rname("Destination Local Queue Name") rqmname("Destination Queue Manager Name")

8) How to create Transmit Queue?

define qlocal("Q_Name") usage(XMITQ) descr("Description")

9) How to create SDR and RCVR Channels?

 define channel("Channel_Name") chltype(SDR) conname("Ipaddress or server name") xmitq("Transmit Queue Name") descr("Description")

define channel("Channel_Name") chltype(RCVR) descr("Description")

10) How to create SVRCONN channel?

define channel("Channel_Name") chltype(SVRCONN) trptype(TCP) descr("Description")

11) What is a multi-instance queue manager?

Multi-Instance Queue Manager is a configuration in which a queue manager will be configured in two servers sharing same file system for MQ operations. One will act as Primary and another one will act as Standby. Whenever the QM in Primary goes down, The QM in secondary server comes to running state and starts to service the requests.

12) The concept behind multi-instance queue manager

In Multi-instance Queue Manager concept, a QM will be configured in two servers. Both the two servers should have the same mq file systems mounted and same level of permissions should be given.

While starting the QM in Primary server, it will acquire the file lock on qm.ini file and the QM in Secondary server will try to acquire the file lock and keep on trying. So when the primary QM goes down, the file lock will be released and the Secondary QM will acquire the lock, start to service the requests.

13) How to create a multi-instance queue manager

  • MQ file systems should be mounted on both the Primary and Secondary servers.
  • mqm user and groups should have same level of access for the mounted file systems in both the servers.
  • Create the QM in primary server with crtmqm command.
  • run "dspmqinf" command and get the output.
  • run "addmqinf " with the parameter we got from previous step in secondary server
  • start QM in Primary server using the command "strmqm -x QM_Name". The server will come up as "RUNNING"
  • start QM in Secondary server using the command "strmqm -x QM_Name". The server will come up as "RUNNING as Standby".

14) What is Cluster in IBM MQ?

MQ Cluster is used to group the Queue Managers logically to avoid multiple channels administration. It reduces the complexity in Distributed Queuing.

The Full repository queue managers have full configuration details about the cluster and partial repository queue managers get the configuration details 'need-to-know' basis.

15) How to configure a cluster?

  • Alter QMGR repos parameter to add a QM to a cluster (alter qmgr repos(CLUS_NAME))
  • Define CLUSRCVR for the Queue Managers (define channel(name) type (CLUSRCVR) trptype(tcp) conname("Alias or IP of same server(port)") cluster(CLUS_NAME))
  • Define CLUSSDR for the Queue Managers (define channel(name) type (CLUSSDR) trptype(tcp) conname("alias or IP of full repos server(post)") cluster(CLUS_NAME))

The first two managers will act as Full Repositories by default. The next queue Managers can be added as partial repos. If a queue manager needs to send message to another queue manager in cluster and it doesn't have the config of the destination QM, then it will get the config details from Full Repos and store it.

Cluster Queues can be created in the Cluster Queue Managers. Any QM in the cluster can put message to that queues, but only local QM can read the messages.

16) What is Pub/Sub concept in MQ?

The traditional Message flow is from a sender to a receiver. But some scenarios may need the messages to send to multiple systems/applications for processing.

To achieve this pub/sub is used. A publisher will be created and 'n' number of subscribers can subscribe to the publisher. Whenever publisher send a message, all the subscribers will get a copy of the message.

17) How to create basic pub/sub structure in MQ?

Creating Pub:

  • Define a topic (define topic("topic_name") topicstr("topic_string") defpsist(yes))
  • Create a alias queue pointing to topic (define qalias("queue_name") target("topic-name") targtype(TOPIC))
  • provide sub access to this topic to a group or principle

If a message is put into the alias queue, it will reach the topic.

Creating Sub:

  • Create a local queue(sub_local_queue) to receive the message
  • Define Sub (define sub(sub_name) topicstr("topic_string") dest(sub_local_queue))

Multiple Sub's can be created for a topic string and each will receive a copy of message if a message is put into the topic.

18. What is Gateway Queue Manager?

Gateway Queue Manager comes into the picture if a single service is running in two separate servers and there is a need to do load balancing between them.

Two Queue Managers will be created with the same interface queue names and a local queue (in each QM) to which the interface queues will be pointing.

Gateway Queue Manager will be clustered with both of these queue managers. When an application attempts to put a message to the interface queues through Gateway QM and since the queue is not managed by Gateway QM, it will search for the queue in the cluster. Since the queue is managed by both the QMs, it will alternatively route the messages to the interface queue in those QMs.

This is a partial questions list only and I will be adding few more questions. Please feel free to update your questions in the comment section, if you want me to add it here.

If you find this post useful, please follow me on Facebook, Twitter and Linkedin to get alerts on new posts. Also please subscribe to the blog.



You may also like

No comments:

Search This Blog

Powered by Blogger.

Blog Archive