Вы находитесь на странице: 1из 45

Table of Contents

What is MQSeries
MQSeries Terminology

MQSeries Facilities
MQSeries Features and Functionality

MQSeries Components and its uses


MQSeries Application Programming

What is MQSeries
MQSeries is an component used to tie together different software applications so
that they can work together. This type of application is often known as business integration software
IBMs middleware for commercial messaging and queuing. Available in 35 different platforms. Enable programs to communicate with each other across a network of unlike

components, such as processors, subsystems, operating systems and communication protocols. MQSeries programs use a consistent application program interface (API) across all platforms.

MQSeries Platforms
MQSeries supports 35 different platforms. Few of the platforms supported by

MQSeries are as listed below.


Lotus Notes AS/400 AT&T GIS UNIX Digital Open VMS HP-UX MVS/ESA SINIX or DC/OSx SUNOS OS/2 Warp Sun Solaris Windows Tandem NSK Windows NT AIX

Message Routing

1r A .o p P rm g u a t s an m1 s Q g o t o

1 Q
A
4r A .o g P rm g e a t s tr m h s e g e p l y f Q r 2 o m

2rB .o P rm g a g m e s te s g t h f Q r 1 o m

2 Q

3r B .o p P rm g u at s am r s eg p l y o n t2 o Q

MQSeries - Basics
Links "nearly everything to almost anything..." Loosely-coupled flexibility via queuing

Programs communicate by sending data in messages, and not by calling directly


Faster and safer application development Common, ease-to-use, multi-platform API Assured message delivery

Time Independence

e u e u Q 1 A e u e u Q 2

Messages and Queues


Some definitions & concepts
A Message is:

A Unit of Information A Request for Service A Reply or Report An Announcement or Broadcast Audio or Video

A Queue is:

A Safe Place to hold Messages A Message can be protected: Across the network or System failures

Messages and Queues Contd.


Message Persistence

A queue can be: - Predefined - Created dynamically by an application More than one application can access a queue

- Persistent - Non Persistent Access to messages - FIFO - Priority - Direct 100 Mb maximum message length (V5) A large message can be segmented into a number of smaller ones

MQ Messages

MH U e=rst s e e s a r a d D g e a e + a
Header: A series of message

H e a d e r

U sa e r D a t

attributes understood and augmented by the Queue Manager, such as: target queue name, length of user data, message priority, reply-to queue name....etc.

User Data: Any sequence of bytes Private to the sending and receiving programs Not meaningful to the Queue Manager

MQ Message types
Message type Request/Reply An application places a message on a queue and expects a reply in return. This

does not necessarily imply synchronous operation, as the process receiving the reply may be separate from the requester. Datagram (Fire&Forget) A datagram message is a message placed on a queue, for which no reply is expected.

Report A report is a message generated by the queue manager if requested by the application on completion of an event.

MQSeries Objects
Queue Manager
The queue manager is an interface to messages and queues. For an application to use MQ, it must first connect to a queue manager. It is possible to run more than one queue manager on the same machine, although

this often causes confusion when testing applications.

MQSeries Objects
Queues Queue is a data structure used to store messages.

It is the most frequently used object type and it is owned by the queue manager. Queues can be defined as local or remote, An application may create a queue dynamically.

MQSeries Objects

Types of Queues:

Local queues Remote queues Transmission Queue Model Queue Dynamic Queue Event Queue Initiation Queue Dead Letter Queue

MQSeries Objects

Channel A channel is defined between two queue managers. Channels are uni-directional. It may be the case that a remote queue exists on a queue manager that is more than one hop away.

Deeper Look at how it works


A p p l A PM UG T S A p p l B GS E G T M AC p p l GS E G T M

Me Q S e r i s If na t c ee r
M ee s s a g Q ug e u i n Se e r v i c M ee s s a g Q ug e u i n Se e r v i c

Me Q S e r i s If na t c ee r

Q 1
M ee s s a g Ce hl a n n A g e n t

Q 2
M ee s s a g Ce hl a n n A g e n t

X M I T Q

Nk er t w o

M Q e ee s s u a g u e Mr a n a g e

M Q e ee s s u a g u e Mr a n a g e

Typical Workflow

Explanation of the workflow


An MQ application, connected to queue manager QM1, puts a message on a remote queue Q2 managed by queue manager QM2. The message is immediately placed on a transmit queue. The Message Channel Agent (MCA) gets the message from the transmit queue. The two MCAs negotiate with each other, and the MQ channel is started. Channels can be configured to be open all the time, or to start when a message arrives on a transmit queue. The receiving MCA inspects the message and determines where to place it. If the message is destined for a different queue manager, it would be placed on another transmit queue, and another channel to that queue manager would be negotiated. The message is now available on the local queue, ready for application on QM2 to process.

MQSeries Trigger
MQSeries triggering enables a program to be started automatically when
messages arrive on a queue. You can set trigger conditions on a queue so that a program is started to process that queue: When the first message arrives on the queue When the number of messages on the queue reaches a predefined number Every time a message arrives on the queue

MQ-Series Trigger

MQSeries Features
Single multiplatform API Assured message delivery Indirect program to program communications Time Independence Programs communicate by sending data in messages, and not by calling directly. Indirect communication Programs communicate thru Queues

MQI Calls
MQI is IBM's message queuing API. Originally published as part of IBM's Open

Blueprint, the interface consists of the following 11 program calls:

MQCONN - connects an application to a particular queue manager. MQOPEN - opens an MQSeries object, such as a queue, and returns a handle for

use in subsequent calls.

MQGET - attempts to retrieve messages from a local queue opened earlier for input. MQPUT - writes messages onto local or remote queues that have previously been

opened for output.

MQPUT1 - a sequence of MQOPEN, MQPUT of one message and MQCLOSE.

MQI Calls Cont..


MQCLOSE - It gives up access to an MQSeries object and, depending on the

options specified, can cause an object such as a dynamic queue and its contents to be destroyed. MQDISC - breaks the connection previously established with a particular MQSeries queue manager. MQINQ - selectively inquires about a variety of MQSeries object attributes. MQSET - allows certain MQSeries object attributes to be set or modified from an application. MQCMIT - indicates to the queue manager that the application has reached a sync point and that all gets and puts since the last sync point are to be made permanent. MQBACK - indicates to the queue manager that it should roll-back all gets and puts that have occurred since the last sync point.

Sample MQI Call


MQCONN CALL 'MQCONN' USING W02-MQM W03-HCONN W03-COMPCODE W03-REASON

END-CALL.

MQI Calls Cont..

MQCONN

MQOPEN

MQCLOSE

MQDISC

MQPUT

Fields in Message descriptor

MQGET

MQGET message options

MQPUT1

MQINQ

MQSET

Return Codes
A completion code and a reason code are returned as output parameters by

each call. These are known collectively as return codes.

The completion code is usually either MQCC_OK or MQCC_FAILED, showing

success and failure, respectively. Some calls can return an intermediate state, MQCC_WARNING, indicating partial success.

There are many reason codes, covering circumstances as a queue being full,

get operations not allowed, and a queue not being defined. ( MQRC_NONE, MQRC_NOT_AUTHORIZED, MARC_Q_MGR_NOT_AVAILABLE)

When the completion code is MQCC_OK, the reason code is always

MQRC_NONE.

Message Persistence

Message Priority

Message and correlation identifier

Retrieving Message using selection criteria

Message Expiry

Impact of MQSeries on Application development


Wide selection of available platforms Applications run in an asynchronous manner; parallelism Assured delivery of information - anywhere in the network Simpler and more rapid development of distributed or client/server applications Limited number of calls with rich functions Messaging means less networking

MQSeries Lotus notes Application

MQSeries Lotus notes Contd

The Steps are Composes a document in the Lotus Notes user database. Activates a macro that includes the @MailSend function. This creates a new mail memo, based on the information supplied in the arguments list, in the add-in tasks Mail-In database. The add-in task periodically checks its own Mail-In Database, and removes the mail memo as soon as it is ready to process it. The add-in task, using the name of the link database entry in the mail memo, refers to the information held in the link database to determine what action is required and what queues are to be used. The add-in task then constructs an MQSeries message from the mail memo and places it on the queue named in the link database entry.

MQSeries Lotus notes Contd


If a reply is expected, the add-in task puts a message containing tracking and

control information, on its own work queue (it uses this information to process the reply). and places a reply on the reply queue..

The MQSeries application removes the message from the queue and processes it The add-in task, after checking its Mail-In database, also checks those queues on

which it is expecting reply messages (the names of which are held in the work queue).

The control information stored earlier on the work queue is removed and used.
The reply message data is used to update the original document on the Lotus

Вам также может понравиться