18 Messaging Solutions in a Linux Environment
򐂰 The client transport type allows an application program to run on a computer
separate from the computer where the queue manager is running. The queue
manager must have a server connection channel defined. This is done in a
synchronous fashion. The application program on Linux normally uses a
TCP/IP network connection to connect to the queue manager.
1.3.6 WebSphere MQ application programming interfaces
The three high-level APIs that are supported are the Message Queueing
Interface (MQI), Java Messaging Service (JMS) and the Application
Management Interface (AMI) that is a downloadable extension. The AMI is fully
supported by IBM but is no longer actively developed.
Introduction to the MQI
One of the enormous benefits of WebSphere MQ is that communicating between
applications can be done with a very small number of programming verbs across
multiple languages. These verbs are also the foundation for object-oriented
language support such as C++, WebSphere MQ for Java and JMS. There are 13
verbs in all but the most frequently used ones are pictured in Figure 1-4:
򐂰
MQCONN - for connecting a program to a queue manager
򐂰
MQOPEN - for opening a connection to an object such as a queue
򐂰
MQPUT - for placing a message in a queue
򐂰
MQGET- for retrieving a message from a queue
򐂰
MQINQ - for retrieving state information about an object such as a queue
򐂰
MQSET - for setting attributes on an object such as a queue
򐂰
MQCLOSE - for closing a connection to an object such as a queue
򐂰
MQDISC - for releasing a programs connection to a queue manager
Figure 1-4 MQI verbs
A
Put
Invoice-Q
Get
Invoice-Q
MQI
Invoice-Q
MQGET
MQOPEN
MQCLOSE
MQPUT1
MQBEGIN
MQCMT
MQBACK
MQPUT
MQCONN
MQCONNX
MQDISC
MQINQ
MQSET
B
Q
u
e
u
e
Chapter 1. Introduction to Linux and messaging 19
For programmatic control of transactions, these additional verbs in Figure 1-5 are
also supported:
򐂰
MQBEGIN - to notify a queue manager that a transaction is about to start
򐂰
MQCMIT - to commit the transaction with a queue manager
򐂰
MQBACK - to roll-back a transaction with a queue manager
Figure 1-5 MQI Transactional Verbs
For further information about programming with WebSphere MQ API’s can be
found in IBM publications:
򐂰 WebSphere MQ Application Programming Guide, SC34-6064-03
򐂰 WebSphere MQ Application Programming Reference, SC34-6062-03
Introduction to C++
The WebSphere MQ C++ classes encapsulate the MQI. There is a single header
file (imqi.hpp) that provides all of the available classes. For C++ applications
written using the C++ classes of WebSphere MQ to work on Linux, the following
compiler and libraries are required:
򐂰 g++ version 2.95.2 or a version 3 compiler
򐂰 libstdc ++ Version 3.0
For further information about programming with WebSphere MQ C++ classes
can be found in the IBM publication WebSphere MQ Using C++ (SC34-6067-02).
Up to date information about using C++ and the C++ classes of WebSphere MQ
on Linux can be found at:
http://www-306.ibm.com/software/integration/mqfamily/platforms/supported/
wsmq_for_linux_intel_5_3.html
...
CALL MQBEGIN
...
CALL MQGET within syncpoint
...
CALL MQPUT within syncpoint
...
EXEC SQL INSERT
...
CALL MQQMT
...
DB2

Get Messaging Solutions in a Linux Environment now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.