242 Moving Forward with the On Demand Real-time Enterprise
5.2.3 DB2 MQ functions
DB2 provides a set of functions that allow us to read from and write to
WebSphere MQ Queues using SQL without having to learn the WebSphere MQ
Series application programming interface. These are implemented as a set of
user defined functions (UDFs). This means that the support is available to
applications that are written in any supported language that supports SQL. We
can use these functions in SQL stored procedures and even from a DB2
command interface.
The DB2 MQ functions allow us to support various messaging paradigms,
including Datagrams, Request/Reply and Publish/Subscribe. In the Datagram
paradigm, we just send or receive messages with no expectation of a reply being
generated. With a Request/Reply, when a message is sent, a reply is expected
and a correlation ID is used to associate the reply with the request when it arrives
back. With Publish/Subscribe, we just send a message to a topic and interested
parties subscribed to that topic will receive the message. There can be any
number of receivers for a topic.
In a basic configuration, a WebSphere MQ server is located on the database
server machine along with DB2. The WebSphere MQ functions are enabled to
DB2 and provide access to the WebSphere MQ server. DB2 clients can be
located on any machine accessible to the DB2 server. Multiple clients can
concurrently access the WebSphere MQ functions through the database.
Through the provided functions, DB2 clients can perform messaging operations
within SQL statements. These messaging operations allow DB2 applications to
communicate among themselves or with other WebSphere MQ applications.
The enable_MQFunctions command is used to enable a DB2 applications to use
the WebSphere MQ functions. It will automatically establish a simple default
configuration that client applications can use with no further administrative
action. The default configuration allows application programmers a quick way to
get started and a simpler interface for development. Additional functionality can
be configured incrementally as needed.
The Application Messaging Interface (AMI) of WebSphere MQ provides a clean
separation between messaging actions and the definitions that dictate how those
actions should be carried out. These definitions are kept in an external repository
file and managed using the AMI Administration tool. This makes AMI applications
simple to develop and maintain. The WebSphere MQ functions provided for DB2
UDB are based on the AMI WebSphere MQ interface. AMI supports the use of
an external configuration file, called the AMI Repository, to store configuration
information. The default configuration includes a WebSphere MQ AMI Repository
configured for use with DB2 UDB.

Get Moving Forward with the On Demand Real-time Enterprise now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.