Your SlideShare is downloading. ×
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
WebSphere MQ tutorial
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

WebSphere MQ tutorial

33,387

Published on

Published in: Technology
6 Comments
12 Likes
Statistics
Notes
No Downloads
Views
Total Views
33,387
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1,789
Comments
6
Likes
12
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. WebSphere MQ Basics For beginners by Joseph Amrith Raj Josephs WebSphere Library http://about.me/webspherelibrary
  • 2. WebSphere MQ BasicsWebSphere MQ:- It is an IBM web sphere product which is evolved in 1990’s. MQ doestransportation from one point to other. It is a middleware tool used for connectivity. Previously itwas known with name ‘mqseries’. MQ supports more than 35+ operating systems. It is platformindependent. For every OS we have different MQ software.WebSphere MQ is a solution for application-to-application communication services regardless of whereyour applications or data reside. Whether on a single server, separate servers of the same type, orseparate servers of different architecture types, WebSphere MQ facilitates communications betweenapplications by sending and receiving message data via messaging queues. Applications then use theinformation in these messages to interact with Web browsers, business logic, and databases. WebSphereMQ provides a secure and reliable transport layer for moving data unchanged in the form of messagesbetween applications but it is not aware of the content of the messages. WebSphere MQ uses a set ofsmall and standard application programming interfaces (APIs) that support a number of programminglanguages, including Visual Basic, NATURAL, COBOL, Java, and C across all platforms.VERSIONS:- 5.0, 5.1, 5.3, 6.0, 7.0(Latest version). Currently widely used version is 6.2PERSISTENT AND NON-PERSISTENT MESSAGES :-MQ differentiates between persistent and non-persistent messages. Delivery of persistentmessages is assured; they are written to logs to survive system failures. Non-persistentmessages cannot be recovered after a system restart.MQ Objects: - objects are used to handle the transactions with the help of services.QUEUE MANAGER maintains all the objects and services.QUEUE: it is a database structure which stores messages until the application or programreceives messages.TYPES OF QUEUES:-• Local Queue• Alias Queue• Model Queue• Remote Queue• Repository QueueLocal Queue:-A queue is local if it is owned by the queue manager to which the application program isconnected. It is used to store messages for programs that use the same queue manager. ForExample, program A and program B each has a queue for incoming messages and anotherqueue for outgoing messages. Since the queue manager serves both programs, all four queuesare local.Note: Both programs do not have to run in the same workstation. Client workstations usuallyuse a queue manager in a server machine.ALIAS QUEUE:-By WebSphere Library Page 2
  • 3. WebSphere MQ BasicsAlias queues are not real queues but they are definitions. They are used to assign differentnames to the same physical queue. Advantages of alias queue allow multiple programs to workwith the same queue but with different attributes or properties.Example:Alias for LQ with different parametersDEFINE QALIAS (PQ) TARGQ (LQ) GET (DISABLED) PUT (ENABLED)DEFINE QALIAS (PQ) TARGQ (LQ) PUT (ENABLED) GET (DISABLED)DEFINE QLOCAL (LQ)Model QueueA model queue is not a real queue. It is a collection of attributes that are used when a dynamicqueue is created.Repository Queue:-These are used in conjunction with clustering and hold either a full or a partial repository ofqueue managers and queue manager objects in a cluster (or group) of queue managers.Remote Queue:-The queue which holds the address of the remote queue manager where the message has tobe sent or delivered. It is a logical queue where we cannot store the messages and get themessages.Note: To send the messages we use only Remote Queue, none other than thisMessage Flow from remote Queue“Remote queue-> Transmission queue-> Channel->Network receiver channel-> Local queue(finally the message will reach here) “CHANNEL Channel (123.456)channel name.CHLTYPE (SDR) sender channelTRPTYPE (TCP) Transport type using TCP protocolCONNAME (127.0.0.1)(1414)?the channel will connect to the IP address specified in the connname and looks for the queue manager which is having listener, port number(1414) andconnects to the queue manager.XMITQ (TQ)?the channel will receive the messages from transmission queue.TYPES OF LOCAL QUEUE:-• Dead letter Queue• Transmission Queue• Initiation Queue• Local Queue.DEAD-LETTER QUEUE: - the enrooted (or) undelivered messages will be landed in to the deadletter queue. We have one control command called runmqdlq.It is a control command which isBy WebSphere Library Page 3
  • 4. WebSphere MQ Basicsused to route the messages through .rul table. This is called dead letter handler. It is importantthat we need a dead letter queue defined for every queue manager.Note:- For one Queue manager we can’t have two dead letter queues.We have system defined objects called SYSTEM.DEAD.LETTER.QUEUE. Or we can use ourown dead letter queue. The messages those are landed in the dead letter header (DLH). Byseeing the dead letter header, we can find the reason and the destination.RULE TABLE:-Syntax:- DESTQ(DLQ) DESTQM(222) REASON(*) WAIT(NO) FWDQ(LQ) FWDQM(222)HEADER(NO)Runmqdlq:-rule table pathTRANSMISION QUEUE:- TQ will receive messages from Remote queue and hits or sends themessages to the channel.CHANNELS:-It is a Networked program to transmit or pas the messages over the network. Channel willreceive the messages from XMITQ which is defined in the definition of the channel.Transmission queue is also a local queue.TYPES OF CHANNELS:-• Message channels.• MQI Channels.MESSAGE CHANNELS:- Message channels are one way piping channels. They are used forsending or receiving the messages. Message channels are unidirectional.TYPES OF MESSAGE CHANNELS:-• Sender Channel(SDR)• Receiver Channel(RCVR)• Server Channel(SVR)• Requester Channel(RQSTR)• Cluster Sender Channel(CLUSSDR)• Cluster Receiver Channel(CLUSRCVR)MQI CHANNELS:- These channels are two way piping channels which can send and receivethe messages in both ways.TYPES of MQI Channels:-• Server Connection Channel (SVRCONN)• Client Connection Channel (CLNTCONN)COMBINATION OF CHANNELS:-• Sender and Receiver• Server and Requester• Cluster sender and Cluster ReceiverBy WebSphere Library Page 4
  • 5. WebSphere MQ Basics• Server Receiver• Sender RequesterLISTENER:-It is a service of MQ. Every Queue Manager will have a listener defined with a unique portnumber. Default port number is:-1414. Listener acts as a mediator between external applicationor queue managers connecting to the queue manager. To contact the queue manager weshould approach through Listener.MQI COMMANDS:-MQI Commands are of three types.• CONTROL COMMANDS• SCRIPT COMMANDS• PCF (programmable command format) COMMANDS.CONTROL COMMANDS :-( case sensitive)• Dspmqver :-to display MQ version• Dspmq :-to view all queue managers of MQ.• Crtmqm :-to create a queue manager• Strmqm :-to start queue manager• Runmqsc :-to enter in to particular queue manager• Endmqm :-to end a queue manager• Dltmqm :-to delete a queue manager• Dspmqcsv :-to display command server• Endmqcsv :-to end command server• Strmqcsv :-to start command server• Runmqlsr :-to run listener service• Endmqlsr :-to end listener service• Runmqchl :-to run a channel out of queue manager• Runmqdlq :-to execute dead letter handle with the help of rule table• Setmqaut :-to set authorizations for particular objects like queuemanager,queue’s channels,listeners to user or group• Dspmqaut :-to display authorization for particular user• Dmpmqaut :-to dump authorization for particular user• Runmqchi :-to run a channel initiator for particular queue manager• Runmqtrm :-to run trigger monitor on initiation queue for particular queue manager• Rcdmqimg :-to take objects (or) record image of a particular queue manager objects• Rcrmqobj :-to recreate the mq objects which are already recorded• Replace :-sSCRIPT COMMANDS:-After entering in to queue manager we can find script commands. Script commands are samefor every queue manager. (These Commands should be used in CAPITAL LETTERS)• DEFINE :-To define/create MQ manager objects like queue, Channels, process, and listener.• ALTER :-to update or modify the existing objectsBy WebSphere Library Page 5
  • 6. WebSphere MQ Basics• DISPLAY :-to view all the properties of a particular object or to Display all objects• DELETE :-to delete created objects• CLEAR :-to clear the message from the queue• END :-to come out of the queue manager• PING :-to check whether other side channel / queue manager is ready to accept our request.• START :- to start the particular channel or listener• STOP :-to stop particular channel or listener• REFRESH :-used to refresh the security every time after giving or executing, set mgr orcommand for queue manager or object• RESET :-used to reset channel,cluster,queue manager• RESOLVE :-to resolve the channel which is in indoubt state• SUSPEND :-to suspend a queue manager from a cluster environment• RESUME :-to remove a queue manager from a cluster environmentCHANNEL STATES: - Channel states are of 5 types• Running• Inactive• Retrying• Stopped• Paused(receiver channel)1. RUNNING: - before going to Running state the status will be initialization and bindingInitialization:-channel will initiate the listener Binding:-sender channel binds with receiver, afterthat it Goes to running state2. INACTIVE:-we have one attribute called disconnect interval (DISCINT) with 6000 milliseconds (default) and it can be changed as of our convenience. If the channel is idle for aparticular period defined in disconnect interval, the channel will go to inactive state.3. RETRYING:-the channel goes to retrying state if the other side queue manager will not beavailable, network issue, may be listener not running, may be receiver channel is in pause state,and may be the receiver channel transportation type is different…. Etc.4. PAUSED STATE:- this state is applicable for receiver (RCVR) channel. Paused state occurswhen the receiving queue is full.Note:- 1. If we do any changes to the channels, listeners, queue manager, to effect the changes we need to stop and then start them. 2. Before starting a channel listener should be in active / running, we can check by pinging the channel. 3. Ping is used to check whether the receiver is in active state or not. Syntax: - PING CHANNEL (CHANNEL NAME)By WebSphere Library Page 6
  • 7. WebSphere MQ BasicsMULTI-HOPPING :-( gate way)Passing the messages between more than one intermediate queue managers is called Multi-Hopping.Note:-For every queue, except remote queue we have two properties. 1. open input count ( Iproess ) 2. open output count ( Oprocss ) 3. the application which is connected and putting the messages is called “ O process “ 4. The application which is processing(getting) the messages is called “I process “ PROCEDURE TO CREATE MULTI-HOPPING:- 1. Create a queue manager QM1, QM2, QM3. 2. Start the queue managers QM1, Create a remote queue with attributes local queue name (Remote Queue Manager) i.e Rname QM3 in RQMname and the transmission queue called XMITQ (TQ). 3. Create a transmission queue called (TQ) 4. Create a sender channel from (QM1.QM2) 5. In Qm2 create, Create a receiver channel (QM1.QM2) 6. Create a transmission queue with name target queue manager name called QM3. 7. Create a sender channel from (QM2.QM3) with transmission queue called XMITQ (QM3) 8. In QM3 create a local queue called (LQ) which is defined in remote queue of QM1 Rqueue(QM1) 9. Create a receiver channel (QM2.QM3)We should have two listeners in QM2 and QM3.GENERAL ERRORS OCCURING IN REALTIME SCENARIO:-1. Mqrc 2059 :- Qmanager not available2. mqrc 2058 :- Qmanager name error3. mqrc 2085 :-unknown object name4. mqrc 2035 :- Not authorized5. mqrc 2033 :-No message available.By WebSphere Library Page 7
  • 8. WebSphere MQ BasicsGetting help on MQRC error codes: mqrc---mq reason codeTRIGGERING:-1. This is an automated event driven by MQ2. Triggering is an event which occurs when specific conditions are met on a queue3. Triggering are of two types1. CHANNEL TRIGGERING2. APPLICATION TRIGGERINGCHANNEL TRIGGERING: - channel triggering is an event which fires the channel whenever acertain conditions are met on transmission queue.Disconnect Interval of a Channel :-It is an attribute or property of the channel(DISCINT).if thechannel is idle for particular interval of time the channel will go to inactive state.(default time is6000 milli seconds)TRIGGER CONDITIONS:-• Trigger ON• Trigger type(first(t.type),every, depth)• Trigger data(channel name which is to be fired)• Initiation queue(SYSTEM.CHANNEL.INITQ)In command prompt:-DEFINE QLOCAL (TQ) USAGE (XMITQ) TRIGGERTYPE (FIRST) TRIGDATA (111.222) INITQ(SYSTEM.CHANNEL.INITQ)To make changes use alter commandALTER QLOCAL (TQ) TRIGGER TRIGTYPE (FIRST) TRIGDATA (111.222) INITQ(SYSTEM.CHANNEL.INITQ)If we want to remove the trigger condition put NO before trigger condition.CHANNEL TRIGGERING PROCESS:-After giving specific conditions to a transmission queue, whenever the messages comes to thetransmission queue, the queue manager will look at the queue, if it is triggered the queuemanager will fire a trigger message in to initiation queue(SYSTEM.CHANNEL.INITQ) with theinformation called trigger type, trigger data, the channel which is to be fired.At the initiation queue (SYSTEM.CHANNEL.INITQ) channel initiator will be watching(monitoring) the initiation queue.Whenever the trigger message comes to initiation queue, the channel initiator will read theinformation and initiates the sender MCA (message channel agent).the sender messagechannel agent will start the channel (which is mentioned in the trigger data).Note:-MCA (message channel agent) is a program which is defined automatically whenever aqueue manager is created.We have two types of MCABy WebSphere Library Page 8
  • 9. WebSphere MQ Basics• SENDER MCA(SDRMCA)• RECEIVER MCA(RCVRMCA)APPLICATION TRIGGERING:- whenever specific conditions met on a local queue applicationtriggering works.TRIGGER CONDITION:-• Trigger ON• Trigger type(first, every(t.type),depth)• Initiation queue(our own defined local queue)• ProcessDEFINE QLOCAL (LQ) TRIGGER TRIGTYPE (EVERY) INITQ (IQ) PROCESS (NOTEPAD).DEFINE PROCESS (NOTEPAD) APPLICID (NOTEPAD.EXE) APPLTYPE (WINDOWS)Runmqtrm –m QM1 –q IQBACKGROUND PROCESS:-1. When ever the message comes to triggered local queue, queue manager will fire triggermessage with information called trigger type and the process definition (application which is tobe triggered) in to the initiation queue (IQ) (our own queue).2. At the initiation queue a long running time program called trigger monitor will be watching(monitoring) the initiation queue.3. Whenever the trigger message occurs in the initiation the trigger monitor will pick theinformation and starts the application which is defined in the process.DEFINE PROCESS (NOTEPAD) APPLICID (NOTEPAD.EXE) APPLYTYPE (WINDOWS NT)COMMAND SERVER:- it is a background process for queue manager when the queuemanager starts command server will be running (default)Note: - we have one attribute (SCMDSERV) and we have two options in that1. QMGR2. MANUALBy default the queue manager command server will be under control of (QMGR). If we changethe SCMDSERV attribute to manual then we need to start command server manually.CONTROL COMMANDS FOR COMMAND SERVER:-• Dspmqcsv• Strmqcsv• Endmqcsv1. Dspmqcsv: - to display the command server for particular queue managerSyntax:-dspmqcsv qmgrnameE.g.:- Dspmqcsv QM1.qmgr2. Strmqcsv:-to start the command server for a particular queue managerBy WebSphere Library Page 9
  • 10. WebSphere MQ BasicsSyntax:-strmqcsv –a qmgrnameEg:-strmqcsv Qm13. Endmqcsv:-to end the command server for a particular queue managerSyntax:-endmqcsv –c –I qmgrnameEg :- endmqcsv –I QM1(queue manager)-c stops the command in a controlled manner.-I stop the command immediately.USE OF COMMAND SERVER:- The command server will allow commands to execute on aqueue manager using (SYSTEM.ADMIN.COMMAND QUEUE). When the command server isstopped the commands, the commands will be stored in the command queue called(SYSTEM.ADMIN.COMMAND QUEUE) After command server comes up the commands wouldbe executed those are in the command queue.AUTHORIZATIONS:-MQ provides authorizations(permissions) for the users in two levels1. Qmanager level2. Object levelMQMgroup:- This group is automatically created by MQ after installation. It also creates oneuser mqm. The users should belong to MQM group so that they can have all the permissions toadminister MQ.COMMANDS TO SET AUTHORIZATIONS:-Setmqaut:- this command is used to set the authorizations.Syntax:- setmqaut [-m qmgrname] [-n objname] –t objtype [-p principal /-g group] [-s servicecomponent ]Dspmqaut :-to display the authorizations which are set to the queue manager.Syntax:- dspmqaut [-m qmgrname] [-n objname ] –t objtype [-p principal/ -g group ] [-s servicecomponent]Example:Dspmqaut –m QM1 –t qmgr –p XX(new user)The entity XX have the following authorizations for object QM1• Inq• Connect• Altusr• Crt• Dlt• Chg• Dsp• Setid• SetallBy WebSphere Library Page 10
  • 11. WebSphere MQ BasicsTROUBLE SHOOTING METHODS:LOGS:- MQ has two types of logs1. TRANSMISSION LOGS2. ERROR LOGSTRANSMISSION LOGS:- the transactions like messages inbound(incoming) andoutbound(outgoing) objects creation, permissions etc. are going to be written to the transactionlogs for every queue managerDefault path for log files in Windows:-[ c:programfilesIBMwebsphere MQlogQMGR(QM1)active directorylog files ]Default path for log files in LINUX, UNIX, SOLARIS, AIX (other than windows):-[ $/var/MQM/log/Qm1/active/logfiles ]Transmission logs are of two types:-1. CIRCULAR LOGS2. LINEAR LOGSLINEAR LOGS: - In linear logs we can recover objects which are damaged and we can takebackup and clear the transactions. By using linear logs we can restart, recover and Imagebackup. In this we need some administrative tasks to monitor the logs and to clear the logs.CHECKPOINT:-It is nothing but creation of objects, which are stored as a transaction and arestored at Checkpoint (objects are LQ, TQ, and Channel…etc)Creation of queue manager in linear logging:-Syntax:-Crtmqm –LL –Lf 2048 –Lp 10 –LS 1 QM2• Lq to create a queue manager in linear logging• Lf to specify the log file size• Lp to specify the number of log primaries• Ls to specify the number of secondary logsNote:-1. In transaction logs we have log primary and log secondary.2. We can view log primary files but we cannot view log secondary Files.3. By default queue manager will take –Lp as 3 and –Ls as 2.4. We can define log primary files maximum up to 250 files and log Secondary files maximumup to 254 files.Log primary files maximum—250Log secondary files maximum—254Creation of image backup by using linear logs:Syntax:- rcdmqimgRcdmqimg[-z] [-L] [-m Qmgrname ] –t objtype[generic object name]Rcdmqimg –m Qm1 –t queue LQTo recover or recreate:-By WebSphere Library Page 11
  • 12. WebSphere MQ BasicsRcrmqobj? this command is used to recover the objects.Syntax:-rcrmqobj[-z] [-m Qmgrname] –t objtype[generic objname]Eg:- rcrmqobj –m Qm1 –t q LQERROR LOGS:-The operations going on(running) on MQ will be written to errorlogs.We have two types of error logs,1.MQ level2.Queue manager level errorsQueue manager level errors:-the operations and errors are written to the queue manager errorfolder.Default path for windows :[ c:program filesIBMwebsphere MQQmgrs(QM1)errorslogfiles ]Path for UNIX, LINUX, and SOLARIS:-[$/var/mqm/qmgrs/Qm1/errors/logfiles ]MQ level errors :- the operations or errors which are occurring on MQ are considered as MQlevel errors.Default path for windows :-[ C:]program filesIBMWebsphere mqerrorslog files ]Path for UNIX, LINUX, SOLARIS :-[ $/var/mqm/errors/logfiles ]MQ Client :-The person or user or application trying to connect access MQ server or queue manager theyneed MQ client installed at their sideMQI channels :-The MQ client will interact with MQ server using server connection (SVRCONN) or Clientconnection channel(CLNTCONN)On MQ client side we have three environmental variables1. MQSERVER ( MQI channels )2. MQCHLTAB ( MQI channel tables )3. MQCHLIB (MQI channel library )Creation of server connection channel :-DEFINE CHANNEL(SVR) CHLTYPE(SVRCONN) TRPTYPE(TCP) DESCR(‘SERVERCONNECTION CHANNEL(not mandatory))Syntax:-Set mqserver=server connection channel name/trptype/IP address(port)Eg :- set Mq server=SVRtcp127.0.0.1(1000)Set MQSERVERResult:- svrtcp127.0.0.1(1000)By WebSphere Library Page 12
  • 13. WebSphere MQ BasicsBy WebSphere Library Page 13

×