Writing and modifying your applications
How to implement a global unit of work.
The sample application programs for Scenario 1 global units of work that are supplied with an IBM® MQ installation are described in the Introducing units of work.
- MQBEGIN
- MQGET
- MQPUT
- SQL INSERT
- MQCMIT
In between MQBEGIN and MQCMIT, the queue manager does not make any calls to the database to update its resources. That is, the only way a database's tables are changed is by your code (for example, the SQL INSERT in the pseudocode).
The role of the queue manager, as far as the database is concerned, is to tell it when a global unit of work has started, when it has ended, and whether the global unit of work should be committed or rolled-back.
As far as your application is concerned, the queue manager performs two roles: a resource manager (where the resources are messages on queues) and the transaction manager for the global unit of work.
Start with the supplied sample programs, and work through the various IBM MQ and database API calls that are being made in those programs. The API calls concerned are fully documented in Sample IBM MQ procedural programs, Data types used in the MQI, and (in the case of the database's own API) the database's own documentation.