Está en la página 1de 16

An Introduction to MQSeries Messaging

and Queuing
What is MQSeries?
A middleware product that implements a messaging and queuing
framework.
Middleware - an intermediate software component that bridges dissimilar
computing environments.
Messaging - programs communicate by sending data in messages rather
than by calling each other directly.
Queuing - messages are put on queues in storage, eliminating the need
for programs to be logically connected.
A messaging and queuing framework is inherently ASYNCHRONOUS!
A rie! Histor" o! MQSeries
#$$% - Systems Strategies (SS! develops e"#ridge, a messaging and
queuing product for $%S, &andem, and 'ni(.
#$$% - #% announces )etworking #lueprint defining three standard A*s
for program to program communication+
, -*--
, .*-
, %/
#$$%&' - State Street #ank (#oston! evaluates #% messaging product
(code name 0$ictory1! for #% --S23SA and SS4s e"#ridge on $%S and
&andem.
State Street Bank would like to announce the wedding of
IBM and Systems Strategies!
#$$' - #% buys intellectual property rights for e"#ridge from SS
(he ride)s Wedding *re+aration
,what SSI had to do-
mplement #% -hannel *rotocol over &-*2* and 5'6.7 (more
about channels later!.
mplement the %/ interface functons (%/-8)), %/8*3),
%/*'&, %/93&, %/-8%%&, %/-58S3, %/:S-!.
mplement %/ 3rror Semantics (failure conditions should look the
same on all systems!
O./ecti0es1
Applications written in - using e"#ridge on $%S and &andem had to
e(change messages with applications written in (-8#85;! 'sing
%/ under --S23SA.
System intercommunication using channel protocol over &-*2* and
5'6.7 (that is, A $%S system had to 0look1 to #% machine <ust like
another #% system!!.
MQSeries *lat!orm Rollout
nitially, #%4s version of %/Series ran only on mainframe (--S23SA,
%S23SA, and eventually $S3!. &he SS version (which was called
%/Series $ersion =! was initially released on $%S, &andem, AS2>??, and
'ni( (S-8, 'ni(@are!.
n =AA>2=AAB #% releases the first three 0distributed1 platforms running it4s
native %/Series implementation+ AC, 8S27, and AS2>??. &he AC version
becomes the 0reference port1.
8ver time, #% gradually replaced the SS version with 0ports1 of its
reference system.
&oday - %/Series runs on over DB platforms.
Question1 @hat about %S%/;
Answer1 9reat if you only want to run on )& platforms (5evel E Systems
built a software adapter to bridge %S%/ and %/Series!.
Message 2low etween A++lications
MQSeries O./ects ,the .asics-
Queue Manager
A queue manager is that part of an %/Series product that
provides the messaging and queuing services to application
programs, through the %essage /ueue nterface (%/!
program calls. t controls access to queues and serves as
transaction (syncpoint! coordinator for all queue operations.
Queue manager names must .e uni3ue4
Queues
%/Series defines !our t"+es o! 3ueues. A queue instance is
fully qualified by its queue manager and queue name.
5ocal Queue - an actual queue for which storage is allocated.
Remote Queue - a definition of a queue on a different queue
manager (acts somewhat like a pointer!
Alias Queue - another name for a local or remote queue.
&ypically used to switch queue destinations without modifying
program code
Model Queue - a template whose properties are copied when
creating a new dynamic local queue (0 create queue ((( 0like1
queue yyy!.
Some +ro+erties o! local 3ueues1
%a(imum %essage Si"e
%a(imum /ueue :epth
Figh25ow Gactors
3nable2:isable *ut or 9et
*ersistent2)ot *ersistent
Some ,more- +ro+erties o! local 3ueues1
5ocal queues can generate events (messages! under certain
conditions (like queue full!.
&hese 0event1 messages can be used to 0trigger1 the e(ecution
of a program.
&hese events are called trigger messages. &he queue on which
they are put is called an Initiation Queue.
*rocess
*rocess defines an application to an %/Series queue
manager. A process definition ob<ect is used for defining
applications to be started by a trigger monitor.
A trigger monitor is a program that listens on an initiation
3ueue and e(ecutes commands named in *rocess definitions.
(riggers and *rocess definitions are useful when you don4t want to
deploy long-running programs. Suppose the message rate is very
low (several minutes between requests!. *erhaps it is better to
instantiate the program for each message, and then let it e(it.
Note+ this is the way --S transaction programs run!
(:id mention that the folks who designed %/Series also designed
--S; #oth --S and %/Series were developed at Fursley
5aboratory in the 'nited Hingdom!.
Channels
A channel provides a communication path between /ueue
%anagers. &here are two types of channels - Message Channels
and MQI channels (also called -lient channels!.
Message channels - provide a communication path between two
queue managers on the same, or different, platforms.
A message channel can transmit messages in one direction only. f
two-way communication is required between two queue managers,
two message channels are required.
6WHY IS A CHANN75 ON7 WAY??8
&here are si( types of message channels+
=. Sender - initiates connection to .eceiver
7. Ser0er - Accepts request to start from requester, then becomes
Sender
D. Recei0er - *assiveI waits for initiation sequence form Sender
>. Re3uester - Active at start, then becomes .eceiver
B. Cluster&sender (used amongst -luster /ueue %anagers!
6. Cluster&recei0er (ditto!
&he Sender side of the session is the 0transaction coordinator1.
%essage channels implement a protocol that includes a
commitment protocol.
-hannels recover from failure by agreement+ they must agree
on the last committed unit of work 6would this .e harder i!
channels were .i&directional??8
MQI channels & connect an %/Series client to a queue manager on
a server machine (where a queue manager is defined!. 'sed for
transfer of %/ calls and responses only and is bi-directional.
How Messages Mo0e Across Channels
Sender&Recei0er Channel
Re3uester&Ser0er Channel
(=! &ransmission /ueue is a local queue.
(7! .emote /ueues 0name1 a transmission queue, and a remote
/ueue %anager (/%7! and q local queue on /%7
(D! App opens queue that is defined as a remote queue
(>! App puts to queue
(B! /ueue manager places message on transmission queue
(6! %essage -hannel Agent reads message and sends to remote
%-A.
(J! .emote %-A gives message to /ueue %anager /%=
(E! /%= puts message to target queue.
Messages
A message any arbitrary data that one program wants to send
to another. &his data is called the a++lication data.
A message needs to include other information, such as its
destination and possibly a return address. &his type of data is
called the message descri+tor
&here are four types of messages+
=. A re3uest message is used by one program to ask another
program for something (usually data!. A request message
needs a reply.
7. A reply message is used in response to a request message.
D. A one&wa" message, as you would e(pect, doesn4t need a
reply, though it can carry data.
>. A report message is used when something une(pected occurs.
Gor e(ample, if the data in a reply message is not usable, the
receiving program might issue a report message.
%ost useful report messages are generated by the /ueue
%anager. Gor e(ample, 9eli0er" con!irmation.
%essages can have a 0time-to-live1, called 7:+ir"; A message
that has not been delivered before its e(piration is removed (not
given to an app!
@hat to do with undeliverable messages; 3ach queue manager
can have a dead-letter queue.
Messages< continued
%essages can be individually designated +ersistent or non-
persistent (persistent messages are logged to enable recovery!
Message Correlator - select which message to get from queue
Message *riorit" - retrieve messages in different order of put
Segmented Messages - allows ending of $3.K 5A.93
messages (L =?? %#!
A message can contain a 0reply to1 address (the name of a
/ueue %anager and /ueue!. &his tells the receiving
application where any response should be sent.
%essages are added and removed from queues in Units o!
Wor=
&he smallest 'nit of @ork is one message.
Units o! wor= are atomic.
@hen an app reads a message from a queue, a message
0appears1 to have been removed, but in fact, it is still in storage
until the app 0commits1 the unit of work.
MQSeries (ransaction Su++ort
Unit o! reco0er" - a piece of work that changes data from one point
of consistency to another.
S"nc+oint - A point of consistency (also called a or commit point!.
t is a moment at which all the recoverable data that an application
program accesses is consistent.
Applications are responsible for delimiting the beginning and
end of a transaction. Fow can messaging be coordinated with
a data base update;
%/Series is >A compliant and can operate with other CA
compliant systems as either a transaction manager
(coordinator! or resource manager (particpant!.
Some e:am+les+ Sybase, :#7, 8racle.
MQSeries 5ogging and Reco0er"
All operations that affect the 0state1 of the /ueue %anager and its
ob<ects are logged to a log file.
@hat is 0state1;
=. 8b<ect definitions (queue manager, queues, processes,
channels, etc!
7. /ueue content (messages!
D. @hat about message channel state;
%essage channel states are logged separately by each
channel.
(wo !orms o! 5ogging
=. Circular M log records are written sequentially across
several files, then 0wrap1 back to the first file.
7. 5inear - log records are written sequentially across files.
)ew files are allocated as current files fill. No automatic
reuse o! !ile s+ace4
*ro.lem1 5ength (in time! of longest running transaction vs amount
of writes to log determines si"e of log needed.
O.ser0ations1
-ircular logging is easy to manage, but is fatal if log is damaged
(hard to backup circular logs!!.
5inear logging is hard to maintain but provides for archiving of
previous logs (still a problem if 0current1 log is damaged!.
MQI ? (he MQSeries *rogramming Inter!ace
%/-8)) M -onnect to queue manager
%/:S- M :isconnect from queue manager
%/8*3) M 8pen ob<ect
%/-58S3 M -lose ob<ect
%/*'& M *ut message
%/*'&= M *ut one message
%/93& M 9et message
%/#39) M #egin unit of work
%/-%& M -ommit
%/#A-H M #ack out
%/)/ M nquire about ob<ect attributes
%/S3& M Set ob<ect attributes
5anguage Su++ort1
-
-NN
-obol
OA$A (native and O%S!
*52
System DA? Assembler
&A5 (&andem!
$isual #asic
2or More In!ormation+ http+22www->.ibm.com2software2ts2mqseries2
ene!its o! MQSeries
Intero+era.ilt"
across dissimilar networks
between different computing environments
As"nchron"
3liminates the time dependency between applications (both apps
must be alive A): have a session in synchronous models!.
2ewer Networ= Sessions
8nly /ueue %angers need to communicate using network sessions.
Administered O./ects
mproves manageability of #9 systems -
-an monitor the state of a queue to determine if apps are doing what
they should+
:oes any process have queue open for reading or writing;
Fas a high water mark been reached;
Fow many messages have been added and removed in a
measured interval;
Message *ersistence PP Assured 9eli0er"
/ueues in stable storage retain messages even if applications fail.
3ven memory-only queues persist if at least the /ueue %anager
stays up.
(ransaction Su++ort
/ueue operations are <ust like reads and writes in a database
transaction!
-an we combine queue operations A): database operations
atomically; (K3S!!

También podría gustarte