Wednesday, January 15, 2014

WebSphere MQ Basics


Introduction to WebSphere MQ:
WebSphere MQ is messaging for applications. It sends messages(Business data) across networks of diverse components. Your application connects to WebSphere MQ to send or receive a message. WebSphere MQ handles the different processors, operating systems, subsystems, and communication protocols it encounters in transferring the message. If a connection or a processor is temporarily unavailable, WebSphere MQ queues the message and forwards it when the connection is back online.
An application has a choice of programming interfaces, and programming languages to connect to WebSphere MQ.

WebSphere MQ is messaging and queuing middle-ware with point-to-point, publish/subscribe, and file transfer modes of operation. Applications can publish messages to many subscribers over multicast.

Point-to-point:
Applications send messages to a queue, or to a list of queues. The sender must know the name of the destination, but not where it is.

Publish/subscribe:
Applications publish a message on a topic, such as the result of a game played by a team. WebSphere MQ sends copies of the message to applications that subscribe to the results topic. They receive the message with the results of games played by the team. The publisher does not know the names of subscribers, or where they are.

Basic MQ topics:
#1 MQ INTERCOMMUNICATION
Types of MQ Objects (Queues, Channels, Listeners, Topic, Subscription)
Types of Queues, Messages and Channels 
#2 TRIGGERING
Channels triggering
Application triggering
#3 DEAD LETTER QUEUE AND DLQ HANDLER USAGE
Setting up DLQ and using DLQ handler
#4 CLIENT-SERVER ARCHITECTURE
Using MQ Environment variable
CCDT file
#5 MQI function CALLS
API/MQI function calls and usage (13++)
#6 LOGGING MECHANISM
Error logs (QMGR/System level)
Transaction Logs (Circular and Linear logging and usage of the logging)
#7 CLUSTERS
Repository’s and Workload balancing
Queue High-availability and QMGR High availability 
#8 CLUSTER OVERLAPPING
Intercommunication in between more than   one cluster
#9 MQ MULTI-HOPPING
sending messages using intermediate queue managers from one qmgr to another qmgr.
#10 SECURITY
Queue / qmgr / Link-lever security and how to grant/revert-back the authority.
#11 MULTI-INSTANCE QUEUE MANAGERS CREATION
Setting-up multi instance queue managers and advantages.
#12 MQ CONFIGURATION FILES OVERVIEW
QM.INI and MQS.INI
#13 MQ CONFIGURATION BACKUP & MESSAGES BACKUP
Queue load and Save qmgr or DSPMQCFG


Control commands:which are run from the command line. You create, start, and stop queue managers with the control commands.

crtmqm              :- use the command to create a Queue manager
strmqm              :- use the command to Start the Queue Manager
endmqm             :- use the command to Stop the Queue Manager
dltmqm              :-  use the command to to Delete the Queue Manager
dspmq                :- to Check the Status of the Queue Manager
dspmq –m (qmgr):-to Check the Status of Particular Queue manager
          
MQ Script Commands:-(MQSC)
runmqsc (qmgr_name):-Use the runmqsc command to issues MQSC commands to a qmgr. Ex:-  runmqsc QM1

Define:- It’s used for defining the object in queue manager(queue, channel, listener, process..etc).

QUEUE TYPES:- mainly we can use 3 objects
1. Remote queue
2. Local queue
3. Transmission queue

Remote Queue: it's a logical queue, contain's destination details. 
DEFINE QREMOTE('Remote Queue Name') +  
RNAME('Destination Queue Name') +  
RQMNAME(Destination MQGR Name) +  
XMITQ(Transmission Queue Name) + 
NOREPLACE

display qr(RQ name) : Display the remote queue detailsdis

qr(*) where(xmitq eq transmission_q_name) : we can filter the RQ's based on xmitqs

Local Queue: it's store the msg's 

DEFINE QLOCAL('q name') +  
DESCR('Local queue - No remote definitions') +  
MAXMSGL(4194304) +  
MAXDEPTH(5000) + 
NOREPLACE

Alter qlocal(q name) : Alter the local queueIf u want to see the ATTRIBUTES of  a queue the command is:display qlocal(q name) 

dis qs(q name)       : Check the status of the queue
DIS QS(QM2.LQ1)
     6 : DIS QS(QM2.LQ1)
AMQ8450: Display queue status details.
   QUEUE(QM2.LQ1)                          TYPE(QUEUE)
   CURDEPTH(1)                             IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)

DISPLAY QSTATUS(QNAME) TYPE(HANDLE)  : Check which app connect to the queue.
  • z/OS batch job name
  • TSO USERID
  • CICS® APPLID
  • IMS™ region name
  • Channel initiator job name
  • i5/OS™ job name
  • UNIX process
DIS QS(QM2.LQ1) TYPE(HANDLE)
     5 : DIS QS(QM2.LQ1) TYPE(HANDLE)
AMQ8450: Display queue status details.
   QUEUE(QM2.LQ1)                          TYPE(HANDLE)
   APPLTAG(WebSphere MQ\bin\amqsput.exe)-connected application to put the msgs
delete ql(q name) : delete the queue

Transmission queue: It's nothing but local queue, it holds the msg's temporarily.  

def ql(q name) usage(xmitq):if you don't mention usage attribute as "xmitq" it's a local queue. make sure you need to mention usage attribute as "xmitq"

CHANNEL: it's nothing but communication link b/w source and target qmgrs.

SENDER CHANNEL: if you want to create a SENDER CHANNEL u can Specify the channel name, channel type (SDR) ,Transport type, connection name & Transmission Queue name..

DEFINE CHANNEL('SDR chl_name') +  
CHLTYPE(SDR) + 
CONNAME('Host_name(port)') + 
XMITQ(Xmitq name) +  
MCAUSER(' ') + 
MAXMSGL(4194304) + 
NOREPLACE

DEFINE CHANNEL('RCVR chl_name') +  

CHLTYPE(RCVR) + 
MCAUSER(' ') + 
MAXMSGL(4194304) + 
NOREPLACE

display channel(channel_name) : Display the chl attributes

DIS CHL(QM1.QM2)
     6 : DIS CHL(QM1.QM2)
AMQ8414: Display Channel details.
   CHANNEL(QM1.QM2)                        CHLTYPE(SDR)
   ALTDATE(2014-01-17)                     ALTTIME(14.10.44)
   CONNAME(LOCALHOST(1418))                CONVERT(NO)

dis chs(chl name) :display the channel status running or not.
DIS CHS(QM1.QM2)
     5 : DIS CHS(QM1.QM2)
AMQ8417: Display Channel Status details.
   CHANNEL(QM1.QM2)                        CHLTYPE(SDR)
   CONNAME(127.0.0.1(1418))                CURRENT
   RQMNAME(QM2)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(APP.XMITQ)
start chl(chl_name) :Starting the channel
stop chl(chl_name) :stop the channel

REATING A LISTENER: Listener is nothing but a program in a particular port number.
DEFINE LISTENER('lstr_Name') +  
CHLTYPE(RCVR) +
PORT(1414) + 
NOREPLACE

1414-its a default port number (IBM suggested)
START LSTR(LSTR_NAME): start the lstr
DISPLAY LSTR(LSTR_NAME): display the lstr

Source Queue Manager:QM1
C:\Windows\system32>RUNMQSC QM1
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM1.

DEF QR(QM1.RQ1) RNAME(QM2.LQ1) RQMANE(QM2) XMITQ(APP.XMITQ)
     1 : DEF QR(QM1.RQ1) RNAME(QM2.LQ1) XMITQ(APP.XMITQ)
AMQ8006: WebSphere MQ queue created.
       :
DEF QL(APP.XMITQ) USAGE(XMITQ)
     2 : DEF QL(APP.XMITQ) USAGE(XMITQ)
AMQ8006: WebSphere MQ queue created.
       :
DEF CHL(QM1.QM2) CHLTYPE(SDR) CONNAME('LOCALHOST(1418)') XMITQ(APP.XMITQ)
     3 : DEF CHL(QM1.QM2) CHLTYPE(SDR) CONNAME('LOCALHOST(1418)') XMITQ(APP.XMITQ)
AMQ8014: WebSphere MQ channel created.
       :
STA CHL(QM1.QM2)
     4 : STA CHL(QM1.QM2)

AMQ8018: Start WebSphere MQ channel accepted.

Target Qmanager:QM2
C:\Windows\system32>RUNMQSC QM2
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM2.

DEF QL(QM2.LQ1)
     1 : DEF QL(QM2.LQ1)
AMQ8006: WebSphere MQ queue created.
       :
DEF CHL(QM1.QM2) CHLTYPE(RCVR)
     2 : DEF CHL(QM1.QM2) CHLTYPE(RCVR)
AMQ8014: WebSphere MQ channel created.
       :
DEF LSTR(LSTR.1418) TRPTYPE(TCP) PORT(1418)
     3 : DEF LSTR(LSTR.1418) TRPTYPE(TCP) PORT(1418)
AMQ8626: WebSphere MQ listener created.
       :
STA LSTR(LSTR.1418)
     4 : STA LSTR(LSTR.1418)

AMQ8021: Request to start WebSphere MQ listener accepted.

1 comment:

  1. Hi Nagi,

    This is to inform you about missing RQMNAME paramter in Remote Queue Definition

    ReplyDelete