Professional Documents
Culture Documents
bijugs@acm.org
Agenda
Websphere MQ Introduction Websphere MQ Objects Websphere MQ Administration Basics Hands-on part 1 Distributed MQ
Websphere MQ Clusters
bijugs@acm.org
Introduction
bijugs@acm.org
bijugs@acm.org
Messaging is
an availability adaptation technique used for the transfer of information between two entities without regard for the immediate availability and accessibility of either
Queuing
a time adaptation technique user for saving information until the intended message receiver is ready to receive it
Messaging and queuing is both asynchronous and connection less Note: entities can be program, persons, systems etc
bijugs@acm.org
Requirements
Distributed applications and systems Increase in program to program communication Heterogeneous Platforms Multiple communication protocols Maximize resource utilization Development complexity and resource skill set
bijugs@acm.org
bijugs@acm.org
MQ Objects
bijugs@acm.org
MQ Message
String of bytes meaningful to the entity using it. Two parts to MQ messages Application Data
Content and structure defined and understood by the application program Contains control information like type of message and priority which are understood and used by MQ
Message Descriptor
Default length is 4 MB; the max length is 100 MB Length can be restricted by the definition of MQ objects and the system storage Messages can be segmented or grouped
bijugs@acm.org
MQ Messages
bijugs@acm.org
MQ Message Descriptor
Version Message ID/Correlation ID Persistent/Non persistent Priority Date and time Life time of a message Coded Character Set Id Format Sender application and type Report options/Feedback Back out counter Segmentation/Grouping information
bijugs@acm.org
MQ Object Types
Queue manager Queue Process Definitions Channels Name lists System Default Objects Clusters Authentication Information Objects
bijugs@acm.org
MQ Object Names
Up to 48 characters for all objects except channels Up to 20 characters for channels
Uppercase A- Z Lowercase a - z Numerics 0 - 9 Period (.) Underscore (_) Forward slash (/)* Percent sign (%)*
* - If used, names should be enclosed in double quotes since these are special characters
bijugs@acm.org
Managing MQ Objects
Control commands typed in through key board. MQSC commands through key board or from files Programmable Command Format (PCF) Messages MQ Administration Interface (MQAI) call from a program MQ Explorer snap-in and MQ services snap-in running under Microsoft management Console*
bijugs@acm.org
MQ Queues
For Applications Local Queues Remote Queues Alias Queues Model Queues Dynamic Queues Used by MQ Initiation Queues Transmission Queues Cluster Transmission Queues Dead-letter Queues Command Queues Reply-to queues Event Queues
bijugs@acm.org
Process definition
Defines an application that starts in response to a trigger Attributes include application type, application ID (path) and data specific to the application
bijugs@acm.org
Channels
Logical communication link Communication path from one MQM to another Used to move messages between MQMs Shields applications from underlying protocols Message Channels connects two MQMs
Uses Message Channel Agents (MCA) Unidirectional Requires a sender, receiver channels and a protocol
bijugs@acm.org
Namelist
Contains a list of MQ objects; queue, cluster, authinfo Typically used by trigger monitors to identify a group of queues Used in clustered environment to inform the availability of an MQ object to clusters Maintained independent of application and can be modified without stopping it Multiple applications can use a Namelist
bijugs@acm.org
MQ Overview1
bijugs@acm.org
MQ Overview
MQ Server (MQM1)
Remote Q
MQ Server (MQM2)
Local Q
MQI Channel
Sender Channel
Receiver Channel
bijugs@acm.org
Putting Together1
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
Basic MQ Administration
bijugs@acm.org
Basic Administration*
Define MQ Objects Display MQ Objects Alter MQ Objects Delete MQ Objects Miscellaneous
MQM Administration
CRTMQM
Create MQ Manager
STRMQM
ENDMQM
DLTMQM
bijugs@acm.org
Delete MQ Manager
MQM Administration
Stop MQ Manager ENDMQM Options By default MQM is quiesced and so takes time -c to notifies all applications to stop but doesn't wait for MQM to end -c is same as issuing ENDMQM with no options -w waits until apps stop and MQM ends -i immediate and doesn't wait for apps to disconnect -p pre-emptive and should be used with caution
bijugs@acm.org
STRMQM TESTQMGR (if not started already) RUNMQSC or RUNMQSC TESTQMGR display QMGR (MQSC Command) END
bijugs@acm.org
Managing Queues
bijugs@acm.org
Create a Process
Delete a Process
bijugs@acm.org
Enabling Triggers
Trigger Types
bijugs@acm.org
Managing Channels
Create a Channel
DISPLAY CHANNEL(MQMA.MQMB)
Delete a Channel
bijugs@acm.org
Managing Namelist
Create a Namelist
DISPLAY NAMELIST(CLUSTERNL)
Delete a Namelist
DELETE NAMELIST(CLUSTERNL)
bijugs@acm.org
bijugs@acm.org
Distributed MQ
bijugs@acm.org
Distributed MQ
Transferring messages between Queue Managers Queue Managers can be on the same machine or world apart Queue Managers can be on the same platform or hetrogenous platforms Implemented using Distributed Queue Management (DQM) features of MQ including MQ Clusters
bijugs@acm.org
Distributed MQ Components
Local and remote Queue Managers and queues Local is one to which an application is connected Remote queue definition Local definition of a queue in a remote MQM Transmission Queues Special local queue to store message temporarily before transmitting to remote destination Message channel agents (MCA) Software that handles sending and receiving Channels One way communication link between MQMs
bijugs@acm.org
Distributed MQ Components
Dead letter queue Special queue to store undelivered messages Transport Service Communication protocol independent of MQ MQ supports multiple protocols Platform dependent Channel Initiators and Listeners Initiators are trigger monitors for sender channels Listeners start receiver channels on receiving request from the sender MCA Channel Exit Programs Used for additional processing like encryption
bijugs@acm.org
Distributed MQ Components
M
App Q
C A
XMIT Q
Channel Initiator
App Q
Init Q
M C A
XMIT Q
App Q
App Q
QM1
QM2
bijugs@acm.org
bijugs@acm.org
On QMB
DEFINE QLOCAL(Q1) DEFINE CHANNEL(A.B)+ CHLTYPE(rcvr)+ TRPTYPE(tcp) Define QREMOTE(Q2)+ RNAME(Q2)+ RQMNAME (QMA)+ XMITQ(QMA) DEFINE QLOCAL(QMA)+ USAGE(XMITQ) DEFINE CHANNEL(B.A)+ CHLTYPE(sdr)+ XMITQ (QMA)+ TRPTYPE(tcp)+ CONNAME(SERVERA.COM)
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
Resolves the remote queue address using the remote queue manager, remote queue name and the transmission queue If the transmission queue is not specified, a transmission queue with the name of the remote queue manager will be used If not available, the default transmission queue of the queue manager will be used
bijugs@acm.org
Messages with MQM QMB_Test in the descriptor will be modified to QMB before being forwarded XMITQ parameter can be used to steer the message to use a specified channel If transmission queue is not specified, the logic detailed in the previous slide will be used
bijugs@acm.org
In PUT call leave the reply to queue manager blank and set the queue name to QMA_Reply At the replying queue manager
Define QLOCAL(QMA_Return)USAGE(XMITQ)
bijugs@acm.org
bijugs@acm.org
DMQ Commands
Stopping Channel Initiators Alter the init queue to disable GET from queue Start MQM Listeners
RUNMQLSR -t TCP -m MQM-p 1414 (control Command)* START LISTENER IPADDR(X.X.X.X) PORT(nnnn) TRPTYPE(tcp) (MQSC Command)
*-This requires editing of /etc/services and /etc/inetd.conf files to add MQSeries 1414/tcp #MQ Listener MQSeries stream tcp nowait mqm /usr/mqm/bin/amqcrsta -q mqm.name
bijugs@acm.org
DMQ Commands
ENDMQLSR -m MQM (control Command) STOP LISTENER IPADDR(X.X.X.X) PORT(nnnn) TRPTYPE(tcp) (MQSC Command)
bijugs@acm.org
DMQ Commands
To test a channel
bijugs@acm.org
MQ Clusters
bijugs@acm.org
DQM vs Clusters
DQM Components Local MQM Remote Q definition Xmit Q definition Sender Channel Remote MQM Local Q Receiver Channel Listener Cluster Definitions Local MQM Cluster receiver channl Cluster sender channel Remote MQM Cluster receiver channl Cluster sender channel
bijugs@acm.org
Cluster Advantages
Reduced system administration due to reduced number of definitions Increased availability and scalability due to easy administration and multiple instances of queues Work load balancing using multiple instances of queues
bijugs@acm.org
bijugs@acm.org
Repository Queue manager is a cluster queue manager which stores a full repository
SYSTEM.CLUSTER.REPOSITORY.QUEUE
Cluster Receiver Channel is the receiving end of a channel on which cluster MQMs can receive messages from other MQMs in the cluster Cluster Sender Channel is the sending end of a channel on which cluster MQMs can send cluster information to one of the full repositories Cluster Transmission Queue transmits all messages from a cluster MQM to any MQM in the cluster
SYSTEM.CLUSTER.TRANSMIT.QUEUE
Command Queue is used to make requests and get responses from full repositories bijugs@acm.org
Clustered MQ Components
Cluster CLUA
App Q
App Q
Full Repository
Full Repository
App Q1
App Q1
XMIT Q
QM1
QM2
bijugs@acm.org
Cluster Definition
On QM1
RUNMQSC ALTER QMGR REPOS(CLUA) DEFINE CHANNEL(TO.QM1)+ CHLTYPE(CLUSRCVR)+ TRPTYPE(tcp)+ CONNAME(QM1.COM)+ CLUSTER(CLUA) DEFINE CHANNEL(TO.QM2)+ CHLTYPE(CLUSSDR)+ TRPTYPE(tcp)+ CONNAME(QM2.COM)+ CLUSTER(CLUA) DEFINE QLOCAL(Q1)+ CLUSTER(CLUA)
bijugs@acm.org
On QM2
RUNMQSC ALTER QMGR REPOS(CLUA) DEFINE CHANNEL(TO.QM2)+ CHLTYPE(CLUSRCVR)+ TRPTYPE(tcp)+ CONNAME(QM1.COM)+ CLUSTER(CLUA) DEFINE CHANNEL(TO.QM1)+ CHLTYPE(CLUSSDR)+ TRPTYPE(tcp)+ CONNAME(QM1.COM)+ CLUSTER(CLUA) DEFINE QLOCAL(Q)+ CLUSTER(CLUA)
bijugs@acm.org
bijugs@acm.org
Verifying a Cluster
Each MQM require a channel initiator to monitor the system defined init Q SYSTEM.CHANNEL.INITQ START CHINIT Each MQM require a channel listener to listen to incoming network requests START LISTENER PORT(1414)+ TRPTYPE(TCP) Verify all the available MQMs in the cluster DISPLAY CLUSQMGR(*) Verify all the channel statuses DISPLAY CHSTATUS(*)
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
MQ Programming
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
Publish/Subscribe Pattern 1
bijugs@acm.org
Request/Reply Pattern 1
bijugs@acm.org
bijugs@acm.org
Transaction Management
ACID unit of work Single phase commit Two phase commit with XA specification compliant resource managers BackoutCount and BackoutThreshold attributes to avoid looping
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
MQ Programming Sequence
Connect to MQM Open MQ Objects Perform n operations Close MQ Objects Disconnect from MQM
MQCONN
MQOPEN
BASIC OP
MQCLOSE
MQDISC
bijugs@acm.org
MQ JAVA Programming
bijugs@acm.org
Normally found in the MQ installation directory Environment variable set-up Add com.ibm.mq.jar to the classpath
com.ibm.mq.jar
CLASSPATH=install_dir\lib\com.ibm.mq.jar
Import com.ibm.mq.*;
bijugs@acm.org
Connection Modes
Connection Modes
Binding Mode
bijugs@acm.org
MQEnvironment
Contains the static variables that control the environment in which a MQQueueManager is constructed Represents the MQ series queue manager Provides inquiry, set,put,get operations for queues Represents the descriptor and data of a MQ message Contains options which control MQQueue.put() method Contains options which control MQQueue.get() method Contains completion codes and error code constants
MQQueueManager
MQQueue
MQMessage
MQPutOptions
MQGetOptions
MQException
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org
bijugs@acm.org