IBM's Message Queue product (developed in
IBM's Hurley Labs in the UK) has the largest market share of any messaging middleware solution.
Its full name was "IBM WebSphere MQSeries" because it runs on WebSphere servers.
IBM dropped the "Series" at v6.0.
v7 debut Oct 2009.
The MQ product consist of three major components operating independently of each other:
- MQ Server
- MQ Queue Manager
- MQS Clients, which maintain synchronous communication / connection with the Queue
Manager. It can participate in local but not global units of work involving MQSeries
resources.
Servers transmit messages communicate via channels — each
a unidirectional link between a MCA (Message Channel Agent) on each queue manager
at each end of the communicating channel.
MQSeries uses the Message Channel Protocol (MCP) to ensure delivery.
MQ messages can be as large as 100MB with v6.0, its latest release.
Several Queue Managers can be clustered so that each queue manager
can access the queues of all other queue managers in a queue-sharing group
through Cluster-sender and Cluster-receiver channels rather than
remote queue definitions.
Information about clusters are held in a SYSTEM CLUSTER REPOSITORY QUEUE
and exchanged through a SYSTEM CLUSTER COMMAND QUEUE.
To ensure high availability and pull workload balancing, applications request web services by connecting to (targeting) a shared queue.
Instead of using a private channel definition to target a specific queue manager, a global definition in a shared repository (DB2 database available to all queue managers) specifies that all servers in the queue-sharing group listen on a generic port (e.g., 4005) for inbound network attach requests. On z/OS, this is done by a listener task started by the channel initiator on each server handling communication between WebSphere MQ on z/OS VTAM and other systems (AIX, Windows, etc.).
If outbound messages are always smaller than 63KB (including headers), a shared channel can provide high availability to communication via synchronization information stored in the SYSTEM.QSG.CHANNEL.SYNCQ queue. Private channels store synchronization data in the SYSTEM.CHANNEL.SYNCQ queue. Consistently smaller messages can take advantage of intra-group queuing such that upon receipt of a message destined for a queue on a different queue manager in its queue-sharing group, enabling messages to "hop" to the correct destination via shared queue SYSTEM.QSG.TRANSMIT.QUEUE instead of using a less efficient transmission queue and channel. Transmission queues temporarily store messages destined for a remote queue manager. To send messages directly, at least one transmission queue is defined for each remote queue manager targeted.
This is why early characterization of Message size Avg/Max is helpful in making configuration decisions.
A message queue channel is "in doubt" when the sending message channel agent is waiting for acknowledgement of receipt for a batch of messages being processed. So information needed to resolve in-doubt units of recovery must come from the coordinating system. WebSphere MQ loses its connection, upon restart it attempts to recover all inconsistent objects.
When a shared queue manager detects another queue manager has terminated abnormally (disconnecting from central z/OS Coupling Facility structures), it performs a multi-phase "peer recovery" process
The number of messages which can fit in a queue (a queue's maximum depth) is the combination of the message size and the size of the persistent z/OS page set where object definitions and message data are stored on non-shared queues. As messages are removed from a queue, space in the page set is freed for reuse.
In-flight (not committed) units of work being performed on the failed queue manager are backed out if the Backout Threshold has not been reached. ???
During the first phase, units of work that progressed beyond the in-flight phase are recovered. This involves committing messages for units of work that are in-commit and locking messages for units of work that are in-doubt. During the second phase, uncommitted messages related to in-flight units of work are rolled back, and input-exclusive information about active handles on shared queues in the failed queue manager are reset, allowing other active queue managers to open the shared queue for input. Request messages in a syncpoint (synchronization point when all the recoverable data that an application program accesses is consistent but not yet put to the response message) are put back on to the request queue and become available for another server instance to process.
IBM WebSphere Application Server Network Deployment V6.0
replaces external clustering software like IBM HACMP with a hot peer failover capability for critical services.
MQI Calls
Applications using the WMQ API (MQI) issue 13 different calls:
- MQCONN connects an application program to a queue manager.
- MQCONNX returns a unique connection handle.
- MQOPEN opens the object before an inquiry, set, get, or put command could be
executed on it.
- MQPMO MQPUT to put messages on queues
- MQGMO MQGET to take them from queues.
- MQPUT1 places messages onto a queue that is already open.
- MQCLOSE closes application objects.
- MQDISC disconnects connections between an application and a queue manager.
- MQINQ inquires on the MQSeries object settings.
- MQSET sets values for attributes of these objects.
- - 13. Syncpoint
commands.
MQ Message Descriptors
MQ messages also contain a Message Descriptor (MQMD)
which contains metadata about (properties of) the message and its application data:
- persistence,
- priority,
- message id,
- correlation id, which provides a reference to a particular topic
- report,
- feedback,
- reply to queue,
- reply to qmanager,
- expiry,
- group id,
- message sequence number,
- offset,
- format,
- encoding and
- coded character set id
Queue Manager Commands
Create QM:
crtmqm -q QMgrName
(-q specifies the default queue manager)
-lc (use circular logging),
-ll (use linear logging),
-lf (specify size of log file)
-lp (specify directory to hold log files) can be passed with the crtmqm command
Delete a queue manager:
dltmqm QMgrName
Start a queue manager:
strmqm QMgrName
If the queue manager is started for the first time, default objects are usually created.
Inquire, define, and alter a queue manager's objects:
mqsc QMgrName
this accepts standard input and standard output options
Display attributes of a queue:
Altered attributes using the ALTER command.
Delete queues using the DELETE command.
Types of Queues
MQ products manage queues (resources):
- Local queues are local to a queue manager. To create a local queue
with a put and get enabled option, a persistence option and maximum depth and maximum message length specified as 1000 and 2000 respectively
DEFINE QLOCAL (MY_QUEUE) REPLACE +
DESCR (" A Local Queue") +
PUT (ENABLED) GET (ENABLED) +
DEFPSIST (YES) SHARE +
MAXDEPTH (1000) MAXMSGL (2000)
- Remote (Distributed) Queues
DEFINE QREMOTE (RQ1) + RNAME (YYY) RQMNAME (QM2)
RNAME refers to the remote queue manager named RQ1
RQMNANE is the name of the remote queue
- Alias Queue which references another local queue or a local definition of a remote queue
can be defined using this:
DEFINE QALIAS (XXX) TARGQ (YYY)
- Model queues are used as a template to create dynamic queues:
DEFINE QMODEL (ANSQ) DEFTYPE (TEMPDYN)
- Dynamic queues can be permanent or temporary in that they do not survive a queue manager restart.
DEFINE QMODEL (ANSQ) DEFTYPE (TEMPDYN)
- Transmission queue
DEFINE QLOCAL (QM1) USAGE (XMITQ)
- A Dead Letter queue is used when either a destination queue is not available or
when application data conversion fails at the sending end. There is a SYSTEM DEFAULT DEAD LETTER QUEUE.
Other topics of functionality:
- Triggering
- MQGMO segmentation options
- Message data translation
- Reporting
- Functional Sequence
- Message groups and Segmented Messages
- Distribution Lists
- MQ Security