Professional Documents
Culture Documents
MQ Fundamentals 02012020 PDF
MQ Fundamentals 02012020 PDF
Websphere MQ Series
Agenda
Websphere MQ Introduction
Websphere MQ Objects
Hands-on part 1
Distributed MQ
Websphere MQ Clusters
Hands-on part 2
Websphere MQ Programming Basics
Hands-on part 3
Introduction
Messaging and Queuing
Telephone answering machine
Punched Cards and processing
Queuing
a time adaptation technique user for saving information
until the intended message receiver is ready to receive it
Heterogeneous Platforms
Windows
UNIX (AIX\Linux\Sun Solaris, HP-UX)
AS/400
Z/OS
Application Data
Reply
Report
Persistent/Non persistent
Priority
Format
Report options/Feedback
Segmentation/Grouping information
MQ Object Types
Queue manager
Queue
Process Definitions
Channels
Name lists
Clusters
Uppercase A- Z
Lowercase a - z
Numerics 0 - 9
Period (.)
Underscore (_)
* - If used, names should be enclosed in double quotes since these are special characters
Managing MQ Objects
Control commands typed in through key board.
MQSC commands through key board or from files
program
MQ Explorer snap-in and MQ services snap-in
messages
Coordinates database and queue data updates
Command Queues
Reply-to queues
Event Queues
Process definition
Defines an application that starts in response to a
trigger
Attributes include application type, application ID
group of queues
Used in clustered environment to inform the
Application
MQPUT
MQI MQI Sender Receiver
Channel Channel Channel Channel
Putting Together1
System Default Objects
Object Name Descriptio n
SYSTEM.ADMIN.CHANNEL.EVENT Event queue for channels
SYSTEM.ADMIN.COMMAND.QUEUE Administration command queue. Used for remote MQSC commands and PCF commands.
SYSTEM.ADMIN.PERFM.EVENT Event queue for performance events
SYSTEM.ADMIN.QMGR.EVENT Event queue for queue manager events
SYSTEM.AUTH.DATA.QUEUE The queue that holds access control lists for the queue manager.
SYSTEM.CHANNEL.INITQ Channel initiation queue
SYSTEM.CHANNEL.SYNCQ The queue that holds the synchroniz ation data for channels.
SYSTEM.CICS.INITIATION.QUEUE Default CICS initiation queue.
SYSTEM.CLUSTER.COMMAND.QUEUE The queue used to carry messages to the repository queue manager.
SYSTEM.CLUSTER.REPOSITORY.QUEUE The queue used to store all repository information
SYSTEM.CLUSTER.TRANSMIT.QUEUE The transmission queue for all messages to all clusters
SYSTEM.DEAD.LETTER.QUEUE Dead-letter (undelivered-message) queue.
System Default Objects
Object Name Descriptio n
SYSTEM.DEFAULT.ALIAS.QUEUE Default alias queue
SYSTEM.DEFAULT.INITIATION.QUEUE Default initiation queue
SYSTEM.DEFAULT.LOCAL.QUEUE Default local queue
SYSTEM.DEFAULT.MODEL.QUEUE Default model queue
SYSTEM.DEFAULT.REMOTE.QUEUE Default remote queue
SYSTEM.MQSC.REPLY.QUEUE MQSC command reply-to queue. This is a model queue.
SYSTEM.PENDING.DATA.QUEUE Support deferred messages in JMS.
Alter MQ Objects
Delete MQ Objects
Miscellaneous
disconnect
-p pre-emptive and should be used with caution
Managing MQM Objects
MQSC Commands by running RUNMQSC
Verify a command without running it
END
TRIGGER TRIGTYPE(first)PROCESS(PROC1)+
INITQ(SYSTEM.DEFAULT.INITIATION.QUEUE)
Trigger Types
every
first
N messages
Managing Channels
Create a Channel
DEFINE CHANNEL(MQMA.MQMB)CHLTYPE(sdr)+
XMITQ(MQMB) TRPTYPE(tcp)+
CONNAME(SERVER1.XYZ.COM)
Display a Channel
DISPLAY CHANNEL(MQMA.MQMB)
Alter a Channel
ALTER CHANNEL(MQMA.MQMB)+
CONNAME(SERVER2.XYZ.COM)
Delete a Channel
DELETE CHANNEL(MQMA.MQMB)
Managing Namelist
Create a Namelist
DEFINE NAMELIST(CLUSTERNL)+
NAMES(CLUSA,CLUSB)+
NLTYPE(CLUSTER)REPLACE
Display a Namelist
DISPLAY NAMELIST(CLUSTERNL)
Alter a Namelist
DEFINE NAMELIST(CLUSTERNL)+
NAMES(CLUSA,CLUSB,CLUSC)+
NLTYPE(CLUSTER)
Delete a Namelist
DELETE NAMELIST(CLUSTERNL)
Hands-on Part 1
MQ Administration
Distributed MQ
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
Transmission Queues
Channels
Transport Service
Platform dependent
App
Q
M Channel M
C Transport C
A Service (TCP) A App Q
XMIT Q
Channel
Listener
Initiator
Init Q
App Q
M Channel M
C C
A Transport A
App Q Service (TCP) XMIT Q
QM1 QM2
Sample DQM Definition1
Define QREMOTE(QMA_Reply) +
RNAME(Answer_QMA)RQMNAME(QMA_Return)
Define QREMOTE(QMA_Return)RNAME()+
RQMNAME(QMA)
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)
Reaching Remote Queue Managers
Point to point
Multi-hopping
Using MQ clusters
DMQ Commands
Start Channel Initiators
RUNMQCHI -q IQ (Control Command)
START CHINIT INITQ(IQ) (MQSC Command)
Stop MQ Channel
STOP CHANNEL(channel-name) (MQSC Command)
Display MQ Channel Status
DISPLAY CHSTATUS(channel-name) (MQSC
Command)
DMQ Commands
To test a channel
PING CHANNEL(channel-name) (MQSC Command)
MQ Clusters
DQM vs Clusters
DQM Components Cluster Definitions
Local MQM Local MQM
Remote Q definition Cluster receiver channl
Sender Channel
Remote MQM
Remote MQM Cluster receiver channl
Receiver Channel
Listener
Cluster Advantages
Reduced system administration due to reduced
number of definitions
Increased availability and scalability due to easy
queues
Cluster Component Details
MQ Cluster is a network of logically related MQMs
and need to be unique in an enterprise
Cluster Queue Manager is a MQM that is a
Cluster - CLUA
App Q
Cluster Receiver Channel
App Q1
QM1 QM2
Cluster Definition
On QM1 On QM2
RUNMQSC RUNMQSC
ALTER QMGR REPOS(CLUA) ALTER QMGR REPOS(CLUA)
DEFINE DEFINE
CHANNEL(TO.QM1)+ CHANNEL(TO.QM2)+
CHLTYPE(CLUSRCVR)+ CHLTYPE(CLUSRCVR)+
TRPTYPE(tcp)+ TRPTYPE(tcp)+
CONNAME(QM1.COM)+ CONNAME(QM1.COM)+
CLUSTER(CLUA) CLUSTER(CLUA)
DEFINE DEFINE
CHANNEL(TO.QM2)+ CHANNEL(TO.QM1)+
CHLTYPE(CLUSSDR)+ CHLTYPE(CLUSSDR)+
TRPTYPE(tcp)+ TRPTYPE(tcp)+
CONNAME(QM2.COM)+ CONNAME(QM1.COM)+
CLUSTER(CLUA) CLUSTER(CLUA)
DEFINE QLOCAL(Q1)+ DEFINE QLOCAL(Q)+
CLUSTER(CLUA) CLUSTER(CLUA)
Adding new QM (QM3) to Cluster
RUNMQSC
DEFINE
CHANNEL(TO.QM3)+
CHLTYPE(CLUSRCVR)+
TRPTYPE(tcp)+
CONNAME(QM3.COM)+
CLUSTER(CLUA)
DEFINE
CHANNEL(TO.QM1)+
CHLTYPE(CLUSSDR)+
TRPTYPE(tcp)+
CONNAME(QM1.COM)+
CLUSTER(CLUA)
Note: QM3 doesn't store a full repository and points to QM1 repository
Adding new QM on DHCP to Cluster
RUNMQSC
DEFINE
CHANNEL(TO.QM3)+
CHLTYPE(CLUSRCVR)+
TRPTYPE(tcp)+
CONNAME('')+
CLUSTER(CLUA)
DEFINE
CHANNEL(TO.+QMNAME+)+
CHLTYPE(CLUSSDR)+
TRPTYPE(tcp)+
CONNAME(QM2.COM)+
CLUSTER(CLUA)
TRPTYPE(TCP)
Verify all the available MQMs in the cluster
DISPLAY CLUSQMGR(*)
DISPLAY CHSTATUS(*)
Load Balancing Using Cluster
Define the same queue in multiple queue managers
in the cluster
MQ series will use the default algorithm (round
Many to one
Publish/Subscribe
Request/reply
avoid looping
Message Queuing Interface (MQI)
Call Purpose
MQCONN Connect to a Queue Manager
MQDISC Disconnect from a Queue Manager
MQOPEN Open a specific Queue
MQCLOSE Close a Queue
MQPUT Put a message on a queue
MQGET Get a message from a queue
MQPUT1 MQOPEN + MQPUT + MQCLOSE
MQINQ Inquire Properties of an object
MQSET Set properties of an object
MQCONNX Standard or fast path bindings
MQBEGIN Begin an unit of work
MQCMIT Commit an unit of work
MQBACK Back out to the start of unit of work
MQI Data Structures
Name Purpose
MQBO Specifies options for MQBEGIN call
MQCNO Specifies options for MQCONNX call
MQDH Describes the data in a distribution-list message
MQGMO Specifies options for MQGET call
MQMD Message descriptor details to control message in a MQGET or MQPUT call
MQOD Object descriptor which is required in a MQOPEN call
MQOR Object record identifies the destinations to work with in a distribution list
MQPMO Specifies options for MQPUT call
MQ Programming Sequence
Connect to MQCONN
MQM
Open MQ MQOPEN
Objects
Perform n BASIC OP
operations
Close MQ MQCLOSE
Objects
Disconnect MQDISC
from MQM
MQ JAVA Programming
JAVA Programming Environment
Required jar file
com.ibm.mq.jar
Normally found in the MQ installation directory
Connection Modes
Client Connection
Binding Mode
Mode
MQ Series JAVA Classes
MQEnvironment
Contains the static variables that control the environment
in which a MQQueueManager is constructed
MQQueueManager
Represents the MQ series queue manager
MQQueue
Provides inquiry, set,put,get operations for queues
MQMessage
Represents the descriptor and data of a MQ message
MQPutOptions
Contains options which control MQQueue.put() method
MQGetOptions
Contains options which control MQQueue.get() method
MQException
Contains completion codes and error code constants
Setting up the Connection
MQEnvironment.hostname=“TEST.SERVER.COM”
MQEnvironment.channel=“TEST.CLIENT.CHNL”
MQEnvironment.port=1638
MQEnvironment.userId=”userABC”
MQEnvironment.password=”password”
MQEnvironment.properties.put(MQC.TRANSPOR
T_PROPERTY,MQC.TRANSPORT_MQSERIES)
MQQueueManager qMgr = new
MQQueueManager(“TEST”);
Interacting with Queues - Put
Int openOptions =
MQC.MQOO_OUTPUT|MQC.MQOO_FAIL_IF_QUIESCI
NG;
MQQueue queue =
qMgr.accessQueue(“TestQ”,openOptions);
MQPutMessageOptions pmo = new
MQPutMessageOptions();
MQMessage outMsg = new MQMessage();
outMsg.format = MQC.MQFMT_STRING;
String msgString = “Test message”;
outMsg.writeString(msgString);
queue.put(outMsg,pmo);
Interacting with Queues - Get
Int openOptions =
MQC.MQOO_INPUT_SHARED|MQC.MQOO_FAIL_IF_Q
UIESCING;
MQQueue queue =
qMgr.accessQueue(“TestQ”,openOptions);
MQGetMessageOptions gmo = new
MQGetMessageOptions();
gmo.options = gmo.options +
MQC.MQGMO_SYNCPOINT;
gmo.options = gmo.options +
MQC.MQGMO_WAIT;
gmo.waitInterval = 3000;
MQMessage inMsg = new MQMessage();
queue.put(inMsg,gmo);
Closing the Connection
qMgr.commit();
queue.close();
qMgr.disconnect();
Hands-on Part 3
MQ Programming
MQ Security
Security Services
Identification and Authentication
Access Control
Confidentiality
Data Integrity
Non repudiation
Digital Signatures
Security Terminology & Concepts
Cryptography
Message Digests
Digital Signatures
Digital Certificates
Certification Authorities
Key Cryptography
Strength of encryption determined by key size; 512
key distribution
Digital Certificates
Concept
Binds public key to a owner and prevents impersonation
Also known as public key certificates
Version number
Serial number
Version number
Serial number
Channel Security
MQ Clusters
MQ Publish/Subscribe
MQ Internet Pass-Thru
connection
bnair@asquareb.com
blog.asquareb.com
https://github.com/bijugs
@gsbiju