Wednesday 13 August 2014

Fundamentals of Websphere MQ Series

Agenda
 Websphere MQ Introduction
 Websphere MQ Objects
 Websphere MQ Administration Basics
 Hands-on part 1
 Distributed MQ
 Websphere MQ Clusters
 Hands-on part 2
 Websphere MQ Programming Basics
 Hands-on part 3

Messaging and Queuing
 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

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

MQ Objects

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
 Message Descriptor
 Contains control information like type of message and
priority which are understood and used by MQ
 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

MQ Messages
 Message Types (Functional)
 Datagram
 Request
 Reply
 Report
 Message Retention Types
 Persistent
 Non-persistent

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

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 (%)*
 Blanks are not allowed

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*

Message Queue Manager (MQM)
 Manages queues of messages for applications
 Provides application programming interface MQI
 Uses existing network facilities to transfer
messages
 Coordinates database and queue data updates
 Segments messages and assembles them
 Allows message grouping and disassembling
 Can send message to more than one destination
 Provides administrative functions on objects
 Special events like triggers and instrumentation
events are generated

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

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

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
 MQI Channels connects MQ client to server
 Bidirectional
 Used for MQ calls and responses only

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

Basic Administration*
 Define MQ Objects
 Display MQ Objects
 Alter MQ Objects
 Delete MQ Objects
 Miscellaneous

MQM Administration
Create MQ Manager
CRTMQM
e.g. CRTMQM /q TESTQMGR
/q – sets the MQM as default
Start MQ Manager
STRMQM
e.g. STRMQM TESTQMGR
Stop MQ Manager
ENDMQM
e.g. ENDMQM TESTQMGR
Delete MQ Manager
DLTMQM
e.g. ENDMQM TESTQMGR
bijugs@acm.

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

Managing Queues
 Create a local queue
 DEFINE QLOCAL(TEST.LOCAL.QUEUE)
 Display a local queue
 DISPLAY QLOCAL(TEST.LOCAL.QUEUE)
 Alter a local queue
 ALTER QLOCAL(TEST.LOCAL.QUEUE) + GET (DISABLED)
 Delete a local queue
 DELETE QLOCAL(TEST.LOCAL.QUEUE) PURGE

Managing Trigger Processes
 Create a Process
 DEFINE PROCESS(PROC1) REPLACE + DESCR('test proc') APPLTYPE(WINDOWS)+ APPLICID('c:\test\prog.exe')
 Display a Process
 DISPLAY PROCESS(PROC1)
 Alter a Process
 ALTER PROCESS(PROC1)USERDATA('12')
 Delete a Process
 DELETE PROCESS(PROC1)

Enabling Triggers
 Enabling trigger in a queue
 DEFINE QLOCAL(TEST.LOCAL.QUEUE)REPLACE +
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)
bijugs@acm.

Enabling Triggers
 Enabling trigger in a queue
 DEFINE QLOCAL(TEST.LOCAL.QUEUE)REPLACE +
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
 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

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 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
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.

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

Channel Types & Combinations
Channel Types
 Sender
 Receiver
 Server
 Requester
 Cluster Sender
 Cluster Receiver
Valid Combinations
 Sender - Receiver
 Requester - Server
 Requester - Sender
 Server - Receiver
 Cluster Sender – Cluster Receiver bijugs@acm.

Queue Addressing & Aliases
 Queue Name + Queue Manager Name + Transmission Queue (if remote queue)
Remote Queue Definition
 Resolves the remote queue location
Queue Manager Alias Definition
 Specifies alternative names for the message
descriptor of a “send” message
Reply-to Queue Alias Definition
 Specifies alternative names for the reply
information in the message descriptor
Aliases are characterized by a blank RNAME in the remote queue definition

Remote Queue Definition
- Define QREMOTE(Q1)RNAME(Q1)+ RQMNAME
(QMB)XMITQ(QMB)
 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

Queue Manager Alias
 Queue Manager Alias
- Define QREMOTE(QMB_Test)RNAME()+
RQMNAME(QMB)
- Define QREMOTE(QMB_Test)RNAME()+
RQMNAME(QMB)XMITQ(QMC)
 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

Reply-to Queue Alias
 Can be used to alter the reply-to queue and queue manager without changing the application
 At the sender queue manager
- 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 shared channels
 Using multiple channels
 Using MQ clusters

DMQ Commands
Start Channel Initiators
 RUNMQCHI -q IQ (Control Command)
 START CHINIT INITQ(IQ) (MQSC Command)
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

Stop MQM Listeners
 ENDMQLSR -m MQM (control Command)
 STOP LISTENER IPADDR(X.X.X.X) PORT(nnnn)
TRPTYPE(tcp) (MQSC Command)
Start MQ Channel
 RUNMQCHL -c CHANNEL -m QM (Control Command)
 START CHANNEL(channel-name) (MQSC Command)
Stop MQ Channel
 STOP CHANNEL(channel-name) (MQSC Command)
Display MQ Channel Status
 DISPLAY CHSTATUS(channel-name) (MQSC Command)

To test a channel
 PING CHANNEL(channel-name) (MQSC Command)


No comments:

Post a Comment