November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Websphere MQ v6 Tutorial

MQ Series/MQ: – It is an IBM web sphere product which is evolved in 1990’s. MQ series does transportation from one point to other. It is an EAI tool (Middleware). WebSphere MQ.

VERSIONS:-5.0, 5.1, 5.3, 6.0, 7.0(new version).
Currently widely used version is 6.2
Note: – MQ series supports more than 35+ operating systems. It is platform independent. For every OS we have different MQ series software’s.

MQ series deals with two things, they are OBJECTS, SERVICES.
In OBJECTS we have
• QUEUES
• CHANNELS
• PROCESS
• AUTHENTICATION
• QUERY MANAGER.
In SERVICES we have LISTENERS.

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 program receives messages.

TYPES OF QUEUES:-
• Local Queue
• Alias Queue
• Model Queue
• Remote Queue
• Repository Queue

Local Queue:-
A queue is local if it is owned by the queue manager to which the application program is connected. It is used to store messages for programs that use the same queue manager. For Example, program A and program B each has a queue for incoming messages and another queue for outgoing messages. Since the queue manager serves both programs, all four queues are local.
Note: Both programs do not have to run in the same workstation. Client workstations usually use a queue manager in a server machine.

Remote Queue:-
The queue which holds the address of the remote queue manager where the message has to be sent or delivered.
It is a logical queue where we cannot store the messages and get the messages.
Note: To send the messages we use only Remote Queue, none other than this

Message 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 channel
TRPTYPE (TCP) Transport type using TCP protocol
CONNAME (127.0.0.1)(1414)?the channel will connect to the IP address specified in the conn name and looks for the queue manager which is having listener, port number(1414) and connects to the queue manager.
XMITQ (TQ)?the channel will receive the messages from transmission queue manager.

ALIAS QUEUE:-
Alias queues are not real queues but they are definitions. They are used to assign different names to the same physical queue.
Advantages of alias queue allow multiple programs to work with the same queue but with different attributes or properties.
Example:
Alias for LQ with different parameters
DEFINE QALIAS (PQ) TARGQ (LQ) GET (DISABLED) PUT (ENABLED)
DEFINE QALIAS (PQ) TARGQ (LQ) PUT (ENABLED) GET (DISABLED)
DEFINE QLOCAL (LQ)

MODEL QUEUE:-
A model queue is not a real queue. It is a collection of attributes that are used when a dynamic queue is created.

Repository Queue:-
Repository queues have existed since Version 5.1 and Version 2.1 for OS/390. They are used in conjunction with clustering and hold either a full or a partial repository of queue managers and queue manager objects in a cluster (or group) of queue managers.

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 dead letter queue.
We have one control command called runmqdlq.It is a control command which is used to route the messages through .rul table.
This is called dead letter handler. It is important that 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 our own dead letter queue. The messages those are landed in the dead letter header (DLH). By seeing 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 path

TRANSMISION QUEUE:-TQ will receive messages from Remote queue and hits or sends the messages to the channel.

CHANNELS:-
It is a Networked program to transmit or pas the messages over the network. Channel will receive 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 for sending 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 receive the messages in both ways.
TYPES:-
• Server Connection Channel (SVRCONN)
• Client Connection Channel (CLNTCONN)

COMBINATION OF CHANNELS:-
• Sender and Receiver
• Server and Requester
• Cluster sender and Cluster Receiver
• Server Receiver
• Sender Requester

LISTENER:-
• It is a service of MQ series
• Every Queue Manager will have a listener defined with a unique port number.
• (Default port number is:-1414)
• Listener acts as a mediator between external application or queue managers connecting to the queue manager.
• To contact the queue manager we should 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 series version
• Dspmq :-to view all queue managers of MQ series.
• 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 :-s

SCRIPT COMMANDS:-
After entering in to queue manager we can find script commands. Script commands are same for 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 objects
• 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 or command 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 environment

CHANNEL 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 binding Initialization:-channel will initiate the listener Binding:-sender channel binds with receiver, after that it Goes to running state
2. INACTIVE:-we have one attribute called disconnect interval (DISCINT) with 6000 milli seconds (default) and it can be changed as of our convenience. If the channel is idle for a particular 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 be available, 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 occurs when 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)

MULTI-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 calles “ I procss “

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 available
2. mqrc 2058 :- Qmanager name error
3. mqrc 2085 :-unknown object name
4. mqrc 2035 :- Not authorized
5. mqrc 2033 :-No message available.
(mqrc—mq reason code)

TRIGGERING:-
1. This is an automated event driven by MQ series
2. Triggering is an event which occurs when specific conditions are met on a queue
3. Triggering are of two types
1. CHANNEL TRIGGERING
2. APPLICATION TRIGGERING

CHANNEL TRIGGERING: – channel triggering is an event which fires the channel when ever a certain conditions are met on transmission queue.

Disconnect Interval of a Channel :-It is an attribute or property of the channel(DISCINT).if the channel is idle for particular interval of time the channel will go to inactive state.(default time is 6000 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 command
ALTER 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 the transmission queue, the queue manager will look at the queue, if it is triggered the queue manager will fire a trigger message in to initiation queue(SYSTEM.CHANNEL.INITQ) with the information 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.
When ever the trigger message comes to initiation queue, the channel initiator will read the information and initiates the sender MCA (message channel agent).the sender message channel 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 a queue manager is created.
We have two types of MCA
• SENDER MCA(SDRMCA)
• RECEIVER MCA(RCVRMCA)

CHANNEL INITIATOR:-
It is a process running on a queue manager when queue manager is in running state. For every queue manager there will only one channel initiator
Note:- 1.In MQseries 5.3 we have to run this channel initiator as a separate process for every queue manager.
2.If we use “&” any process will run at background. this applicable for all.
Syntax:- runmqchi –m Qmanagername –q initq.
Example :- runmqchi –m QM1 –q SYSTEM.CHANNEL.INITQ
To run channel initiator for queue manager QM1.
In solaris / unix /linux /AIX we run the channel initiator as follows.
Runmqchi –m QM1 –q SYSTEM.CHANNEL.INITQ &

APPLICATION TRIGGERING:-when ever specific conditions met on a local queue application triggering works.

TRIGGER CONDITION:-
• Trigger ON
• Trigger type(first, every(t.type),depth)
• Initiation queue(our own defined local queue)
• Process
DEFINE QLOCAL (LQ) TRIGGER TRIGTYPE (EVERY) INITQ (IQ) PROCESS (NOTEPAD).
DEFINE PROCESS (NOTEPAD) APPLICID (NOTEPAD.EXE) APPLTYPE (WINDOWS)
Runmqtrm –m QM1 –q IQ

BACKGROUND PROCESS:-
1. When ever the message comes to triggered local queue, queue manager will fire trigger message with information called trigger type and the process definition (application which is to be 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 the information 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 queue manager starts command server will be running (default)
Note: – we have one attribute (SCMDSERV) and we have two options in that
1. QMGR
2. MANUAL
By default the queue manager command server will be under control of (QMGR)
If we change the SCMDSERV attribute to manual then we need to start command server manually.

CONTROL COMMANDS FOR COMMAND SERVER:-
• Dspmqcsv
• Strmqcsv
• Endmqcsv
1. Dspmqcsv: – to display the command server for particular queue manager
Syntax:-dspmqcsv qmgrname
E.g.:- Dspmqcsv QM1.qmgr
2. Strmqcsv:-to start the command server for a particular queue manager
Syntax:-strmqcsv –a qmgrname
Eg:-strmqcsv Qm1
3. Endmqcsv:-to end the command server for a particular queue manager
Syntax:-endmqcsv –c –I qmgrname
Eg :- 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 a queue manager using
(SYSTEM.ADMIN.COMMAND QUEUE)
When the command server is stopped the commands, the commands will be stored in the command queue called
(SYSTEM.ADMIN.COMMAND QUEUE)
After command server comes up the commands would be executed those are in the command queue.

AUTHORIZATIONS:- MQseries provides authorizations(permissions) for the users in two levels
1. Qmanager level
2. Object level
MQMgroup:- This group is automatically created by MQseries after installation. It also creates one user (MUSR_MQADMIN)
The users should belong to MQM group so that they can have all the permissions to administer MQ series.

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 service component ]

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 service component]

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
• Setall
Object level :-
Syntax:-
Setmqaut –m QM1 –n LQ –t queue –pXX +put
Dspmqaut –m QM1 –n LQ –t queue –p XX
The setmqaut command completed successfully

Semqaut –m QM1 –n(20.30) –t channel –pXX +allmqi
Runmqsc QM1
Starting MQSC for queue manager 1
• REFRESH CLUSTER
• REFRESH SECURITY(generally we refresh security)
Result: web sphere security cache refreshed

TROUBLE SHOOTING METHODS:
LOGS:- MQseries have two types of logs
1. TRANSMISSION LOGS
2. ERROR LOGS

TRANSMISSION LOGS:-the transactions like messages inbound(incoming) and outbound(outgoing) objects creation, permissions etc. are going to be written to the transaction logs for every queue manager
Default path for log files in Windows:-
[ c:\programfiles\IBM\websphere MQ\log\QMGR(QM1)\active directory\log 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 LOGS
2. LINEAR LOGS

LINEAR LOGS: – In linear logs we can recover objects which are damaged and we can take backup and clear the transactions.
By using linear logs we can restart, recover and Image backup. 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 are stored 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 logs
Note:-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 maximum up to 254 files.
Log primary files maximum—250
Log secondary files maximum—254
Creation of image backup by using linear logs:
Syntax:- rcdmqimg
Rcdmqimg[-z] [-L] [-m Qmgrname ] –t objtype[generic object name]
Rcdmqimg –m Qm1 –t queue LQ
To recover or recreate:-
Rcrmqobj? this command is used to recover the objects.
Syntax:-rcrmqobj[-z] [-m Qmgrname] –t objtype[generic objname]
Eg:- rcrmqobj –m Qm1 –t q LQ

ERROR LOGS:-
The operations going on(running) on MQ series will be written to errorlogs.
We have two types of error logs,
1.MQseries level
2.Queue manager level errors
Queue manager level errors:-the operations and errors are written to the queue manager error folder.
Default path for windows :
[ c:\program files\IBM\websphere MQ\Qmgrs(QM1)\errors\logfiles ]
Path for UNIX, LINUX, and SOLARIS:-
[$/var/mqm/qmgrs/Qm1/errors/logfiles ]
MQ series level errors :- the operations or errors which are occurring on MQ series are considered as MQ series level errors.
Default path for windows :-
[ C:]program files\IBM\Websphere mq\errors\log files ]
Path for UNIX, LINUX, SOLARIS :-
[ $/var/mqm/errors/logfiles ]

MQ series Client :- The person or user or application trying to connect access MQseries server or queue manager they need MQ series client installed at their side

MQI channels :-The MQseries client will interact with MQ series server using server connection (SVRCONN) or Client connection channel(CLNTCONN)
In MQ client sid ewe have three environmental variables
1. 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(‘SERVER CONNECTION CHANNEL(not mandatory))
Syntax:-
Set mqserver=server connection channel name/trptype/IP address(port)
Eg :- set Mq server=SVR\tcp\127.0.0.1(1000)
Set MQSERVER
Result:- svr\tcp\127.0.0.1(1000)

PERSISTENT AND NON-PERSISTENT MESSAGES :-
MQSeries differentiates
Between persistent and non-persistent messages. Delivery of persistent messages is assured; they Are written to logs to survive system failures. In an AS/400 these logs are Journal Receivers.
Non-persistent messages cannot be recovered after a system restart.

How a Client Sends a Request:-
The client starts a program that puts a message on a queue. For this function five MQSeries API calls are executed
• MQCONN to connect to the queue manager in the server
• MQOPEN to open the message queue QS1 for output
• MQPUT to put a message in the queue
• MQCLOSE to close the queue QS1
• MQDISC to disconnect from the queue manager

How the Client Receives a Reply :-
The client program knows the name of its input queue, here QA1 or QB1. The application can use two modes of communication: • Conversational
If the application uses this mode of communication with the server program, it waits for the message to arrive before it continues processing. This means, the reply queue is open and an MQGET with wait option has been issued.
The client application must be able to deal with two possibilities:
• The message arrives in time.
• The timer expires and no message is there.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>