Upload
mohamed-kajamoideen
View
206
Download
15
Embed Size (px)
Citation preview
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
IBM’s 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
A B
1. Program A puts a msg onto Q1
3. Program B puts a reply msg onto Q2
4. Program A gets the reply msg from Q2
2. Program B gets the msg from Q1
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
Queue
1
A
B
Queue
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 - 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
A queue can be:
- Predefined
- Created dynamically by an application
More than one application can access a queue
MQ Messages
Header: A series of message attributes understood and augmented by the Queue Manager, such as: target queue name, length of user data, message priority, reply-to queue name....etc.
Message = Header + User Data
Header User Data
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 ObjectsQueues 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
Message Queue Manager
MessageChannelAgent
Message Queue Manager
MessageQueuingService
MessageChannelAgent
MQSeriesInterface
MQSeriesInterface
Q1 Q2
XMIT
QNetwork
MessageQueuingService
Appl A
PUT MSG
Appl B
GET MSG
Appl C
GET MSG
Typical Workflow
Explanation of the workflowAn 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 MCA’s 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 CallMQCONN
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 CodesA 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 task’s 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).
The MQSeries application removes the message from the queue and processes it and places a reply on the reply queue..
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