Académique Documents
Professionnel Documents
Culture Documents
Websphere MQSeries
Page 1
MQSeries
Middleware?
MQSeries?
Page 2
INTRODUCTION
Page 3
Communication Styles
Page 4
Page 5
Page 6
Synchronous Communication
Advantages
Easy
Error
Service
to program
Outcome
is known immediately
Better
Disadvantages
Requestor
tied up
Usually
requires connection-oriented
protocol
Page 7
Asynchronous Communication
Advantages
Disadvantages
Response
request is made
Error
complex
freed
Page 8
What's in a message?
2.
Messaging API
Page 9
What is in a Queue?
General Characteristics
Queues are described as having First In, First Out (FIFO) behavior,
where the earliest added entries are removed first.
Some queues enforce strict FIFO ordering, but the message position
may vary as per their priorities.
Page 10
Queuing
Page 11
Security.
Data integrity.
Recovery support.
Page 12
The mechanism by which a message moves from queue to queue is hidden from the programs.
Hence the programs are simpler.
Page 13
Time-independent communication
Programs requesting others to do work do not have to wait for the reply to a request.
Page 14
Programs requesting others to do work do not have to wait for the reply to a request.
Page 15
Event-driven processing
Message priority
Security
Data integrity
Page 16
Page 17
Page 18
Page 19
MQ Series Basics
storage,
logging and
MQSeries can take care of translating the data when source and target
application uses different character sets.
Page 20
Page 21
MQ Series Basics
ActiveX
Assembler (MVS/ESA)
C, C++
(MQI)
COBOL
Java
JMS
AMI
LotusScript
PL/1
publish/subscribe messaging.
RPG (AS/400)
SmallTalk
programming languages
Page 22
MQSeries Server
Its the Messaging & Queuing software. Provide infrastructure for storing ,
forwarding and maintaining data integrity ,etc for messages
MQSeries Client
Page 23
One-to-one or Point-to-Point
Characteristics
Page 24
Characteristics
Page 25
Characteristics
Page 26
Message brokers make sure that messages arrive at the correct destinations, and are
transformed to the format required at each destination.
Page 27
Request/reply
Flow of message is complete when the initiating side receives the reply
message.
Page 28
Sending application sends messages without expecting any reply from the
receiving application.
Page 29
Messages are
String of Bytes
Message Descriptor/Header
The message descriptor identifies the message (message ID) and contains
control information, also called attributes, such as message type, expiry time,
correlation ID, priority, and the name of the queue for the reply.
Page 30
Page 31
Version:
The version of the message descriptor depends on the MQSeries version and
platform you use.
Message ID:
This is a byte string that is used to distinguish one message from
another
Generally, no two messages should have the same message identifier,
although this is not disallowed by the queue manager. The message
identifier is a permanent property of the message, and persists across
restarts of the queue manager.
2004 Cognizant Technology Solutions. Proprietary and confidential.
Page 32
These fields allow the application that receives the reply to correlate the
reply with its original request.
Persistent/Non-persistent
Persistent messages always arrive at their destination, even when the system
fails.
Page 33
Datagram
2.
Request
3.
Reply
4.
Report
Types
Page 34
Persistent
Delivery of persistent messages is assured.
Slower
Recovery
2.
Non-Persistent
Delivery is not assured
Faster
No Recovery
Page 35
Page 36
Queue managers
Queues
Namelists
Process definitions
Channels
Listener
AuthInfo
Page 37
Page 38
Page 39
Can send one message to more than one destination with one API call
using a user-defined distribution list, thus reducing network traffic.
Page 40
crtmqm q (QM1)
endmqm i (QM1)
c, i and p options
dltmqm (QM1)
Page 41
Display qmgr
Alter qmgr *
end
Page 42
Types of Queues
Page 43
Local Queue
2.
Remote Queue
Page 44
Transmission Queue
The syntax and the property to be created along with a transmitQ is given
by
DEFINE QLOCAL(X1) USAGE(XMITQ)
(X1 IS THE NAME OF THE LOCAL Q BUT AS WE HAVE GIVEN
USAGE AS XMITQ IT WILL BE USED AS TRANSMITQ)
Page 45
5.
6.
Dynamic Queue
Types:
Model Queue
Alias Queue
Page 46
8.
9.
Initiation Queue
Reply-To Queue
Dead-Letter Queue
Queue into which Queue Manager writes the message if the messages cant be written
to queue.
Some samples:
Page 47
11.
12.
Repository Queue
Event queues
Command queues
Page 48
Namelists
Page 49
Process definitions
Page 50
AuthInfo:
Page 51
Channels
Channel Types
1. Message channels
Unidirectional
Transfers messages from XMIT Queue to communication link and from Communication link to
target Queue
2. MQI channels
Transfer MQI calls from a WebSphere MQ client to a queue manager, and responses from a
queue manager to a WebSphere MQ client.
SNA LU 6.2
TCP/IP,
NetBIOS, SPX
DEC Net
Page 52
Channels
SENDER CHANNEL(SDR)
RECIEVER CHANNEL(RCVR)
Page 53
Page 54
Listener:
the channel listener detects incoming network requests and starts the
associated channel.
Creates a Listener with Listener.name And Transmit Type is TCP And Port
no of the Listener
Page 55
Install MQSeries
Strmqm
runmqsc
Page 56
1.
MQCONN
7.
MQPUT1
2.
MQDISC
8.
MQBEGIN
3.
MQOPEN
Open queue
9.
MQCMIT
Commit
4.
MQCLOSE
Close queue
10.
MQBACK
Back out
5.
MQPUT
Put message
11.
MQINQ
6.
MQGET
Get message
12.
MQSET
Page 57
Page 58
Listener
Trigger Monitor
Channel Initiator
Page 59
Steps
1.
2.
3.
4.
Usually, all messages destined for one remote QueueManager use the same xmit
queue
Page 60
Steps
5.
To start a channel automatically, the xmit queue must be associated with a channel
initiation queue, so that Queue Manager puts a init message to Channel initiation queue
iii. MCA moves the message over the network to the other machine, using the
sender part of the message channel pair.
iv. Listener program monitors a specified port (default port is 1414)
v. On Message arrival at the port Listener start MCA at receiving end
vi. MCA moves the message into specified local queue using the receiver part of the
message channel pair.
Note: Both channel definitions, sender and receiver, must have the same name.
6.
Page 61
Page 62
Messages destined for a remote queue manager are put into a remote
queue.
Page 63
2.
Queue Name
No location transparency
Page 64
Page 65
Once in the system that sends the message (sender channel) and once in the system
that receives the message (receiver channel).
Each channel pair (sender and receiver) must have the same name.
Page 66
System B (QMB)
DEFINE QLOCAL(Q1)
DEFINE QLOCAL(QMB) +
USAGE(xmitq)
DEFINE CHANNEL(QMA.QMB) +
CHLTYPE(sdr) +
XMITQ(QMB) +
TRPTYPE(tcp) +
CONNAME(9.24.104.123)
DEFINE CHANNEL(QMA.QMB) +
CHLTYPE(rcvr) +
TRPTYPE(tcp)
DEFINE QLOCAL(Q2)
DEFINE QREMOTE(Q2) +
RNAME(Q2) RQMNAME(QMA) +
XMITQ(QMA)
DEFINE QLOCAL(QMA) +
USAGE(xmitq)
DEFINE CHANNEL(QMB.QMA) +
CHLTYPE(rcvr) +
TRPTYPE(tcp)
DEFINE CHANNEL(QMB.QMA) +
CHLTYPE(sdr) +
XMITQ(QMA) +
TRPTYPE(tcp) CONNAME(ABC1)
Page 67
The commands to start listener and channel for queue manager QMA
are:
strmqm QMA
start runmqlsr -t tcp -m QMA -p 1414
runmqsc
start channel (QMA.QMB)
End
With the first command you start queue manager QMA, if not already
started.
The next command starts the listener. Itlistens on behalf of QMA on port
1414. As transmission protocol TCP/IP is used.
Page 68
start runmqchi
With the first command you start the listener
With the second the channel initiator program.
Page 69
Channel Initiator:
You can also start server channels in this way if you specified the
connection name of the partner in the channel definition.
Page 70
Page 71
Message-retry
If the MCA is unable to put a message to the target queue for a reason that could
be transitory (for example, because the queue is full), the MCA has the option to
wait and retry the operation later.
Specify a message-retry time and interval for MQPUT errors when you define
your channel.
Return-to-sender
If message-retry was unsuccessful, or a different type of error was encountered,
the MCA can send the message back to the originator.
Specify the following options in Message Descriptors
Dead-letter queue
If a message cannot be delivered or returned, it is put on to the dead-letter queue
(DLQ).
Page 72
set MQSERVER=CHAN1/TCP/9.24.104.206(1414)
where:
MQSERVER is the name of the environment variable.
CHAN1 is the name of the channel to be used for communication between client
and server. This channel is defined in the server. MQSeries will automatically
create it should it not exist.
TCP denotes that TCP/IP is to be used to connect to the machine with the
address following the parameter.
Page 73
Why Triggering?
This may not be desirable when the number of messages arriving on the
queues is unpredictable.
What is MQ Triggering?
Page 74
Triggering allows
Instantiation as required
Automation of flow
Page 75
Application queue
Process Definition
Holds details of the application that will get messages from the
application queue.
Transmission queue
Local queue, which, when it has triggering set on and when the conditions
are met, requires that trigger messages are written
Trigger Events
Page 76
Trigger message
Application to be started
Application Queue
Process Definition
Initiation queue
Trigger monitor
When a trigger message arrives on an initiation queue, the trigger monitor retrieves the
message.
It issues a command to start the application that is to retrieve the messages arriving on
the application queue, passing it information contained in the trigger message header,
which includes the name of the application queue.
2004 Cognizant Technology Solutions. Proprietary and confidential.
Page 77
Page 78
2.
The queue manager checks to see if the conditions are met under
which it has to generate a trigger event. They are, and a trigger event is
generated. Information held within the associated process definition
object is used when creating the trigger message.
3.
The trigger monitor retrieves the trigger message from the initiation
queue.
5.
6.
Page 79
Page 80
EVERY
Every time a message is put in the target queue a trigger message is also
put in the initiation queue. Use this when your program exits after
processing one message or transaction, as shown above on the left.
FIRST
A trigger message is put in the initiation queue only when the target queue
has been empty. Use this when the program exits only then when there
are no more messages in the queue, as shown on the right.
n messages
A trigger message is put in the initiation queue when there are n messages in
the target queue. For example, you can start a batch program when the
queue holds 1000 messages.
Page 81
MQ Series Clusters
Page 82
MQ Cluster
Why Clustering
Page 83
Cluster components
Cluster queue - Queue that is hosted by a cluster queue manager and made
available to other queue managers in the cluster
Repository contains information such as queue manager names, their locations, their
channels, which queues they host, etc.
Typically, two queue managers in a cluster hold a full repository. The remaining queue
managers all hold a partial repository.
Full repository - Queue manager that hosts a complete set of information about
every queue manager in the cluster is referred to as having a full repository for
the cluster.
Page 84
Cluster components
Cluster transmission queue - transmits all messages from the queue manager
to any other queue manager that is in the same cluster.
Page 85
MQ Clusters
Page 86
Number
per QM
Total
number
12
12
12
24
12
Total
number
Description
Page 87
Creating MQ Clusters
SYSTEM.CLUSTER.REPOSITORY.QUEUE
This local queue is used to store all the repository information.
SYSTEM.CLUSTER.COMMAND.QUEUE
This local queue is used to carry messages to the repository.
SYSTEM.CLUSTER.TRANSMIT.QUEUE
This is the transmission queue for all messages to all queues and queue
managers that are within clusters.
SYSTEM.DEF.CLUSSDR
This is used to supply default values for any attributes that you do not specify
when you create a cluster sender channel on a queue manager in the cluster.
SYSTEM.DEF.CLUSRCVR
This is used to supply default values for any attributes that you do not specify
when you create a cluster-receiver channel on a queue manager in the cluster.
Page 88
Creating MQ Clusters
TCP/IP Port
QM_1
1415
QM_2
1416
QM_3
1417
QM_4
1418
Page 89
Sample MQ Put
Sample MQ Get
MQ Browse
Page 90
Page 91
Page 92
Page 93
Unit of Work
MQCONN()
.
MQBEGIN()
..
MQGET(MQGMO_SYNCPOINT)
...
EXEC SQL UPDATE
...
MQCMIT()
MQDISC()
Page 94
Units of work that make only queue manager updates can be started using an MQGET,
MQPUT or MQPUT1 call specifying the appropriate syncpoint option.
Units of work that also need to update global resources owned by a database manager need to
be started using an MQBEGIN call.
Valid
Invalid
Invalid
MQCONN ()
MQCONN ()
MQCONN ()
MQPUT (MQPMO_SYNCPOINT)
MQPUT (MQPMO_SYNCPOINT)
...
MQCMIT ()
...
MQBEGIN ()
......
MQBEGIN ()
...
MQBEGIN ()
MQBEGIN ()
MQGET (MQGMO_SYNCPOINT)
EXEC SQL UPDATE
MQCMIT ()
Page 95
Page 96
Physical Message
Logical Message
Message Segment
Page 97
Page 98
Segmentation
Receiving application has the option to either receive the entire message in
one piece or each segment separately.
Used in situations where the Message length is more than that is allowed.
Page 99
To allow the queue manager to perform segmenting on its own when the message
exceeds MAXMSGL, specify in the message descriptor:
md.Version = MQMD_VERSION_2;
md.MsgFlags = MQMF_SEGMENTATION_ALLOWED;
The receiving application can get each message segment individually or have the
queue manager reassemble the message and return it to the program after all
segments have been received.
The queue manager makes sure that the segments are in the correct order.
gmo.OPTIONS += MQGMO_COMPLETE_MSG;
Take a message which is too big (either for the queue manager or for the specific
queue)
MQSeries breaks the message into smaller messages (called segments) and sends them
wherever the too large message would have been sent.
The local queue manager at the receiving end puts the pieces back together and is able to
present the too large message to the GETting application as though it had never been
segmented.
2004 Cognizant Technology Solutions. Proprietary and confidential.
Page 100
Grouping
Page 101
THANK YOU
Page 102