This chapter describes how to commit and back out any recoverable get and put operations that have occurred in a unit of work. The following terms, described below, are used in this topic:
If you are familiar with these transaction processing terms, you can skip to Syncpoint considerations in WebSphere MQ applications.
Similarly, when a program gets a message from a queue within a unit of work, that message remains on the queue until the program commits the unit of work, but the message is not available to be retrieved by other programs. The message is permanently deleted from the queue when the program commits the unit of work. If the program backs out the unit of work, WebSphere MQ restores the queue by making the messages available to be retrieved by other programs.
Changes to queue attributes (either by the MQSET call or by commands) are not affected by the committing or backing out of units of work.
The decision to commit or back out the changes is taken, in the simplest case, at the end of a transaction. However, it can be more useful for an application to synchronize data changes at other logical points within a transaction. These logical points are called syncpoints (or synchronization points) and the period of processing a set of updates between two syncpoints is called a unit of work. Several MQGET calls and MQPUT calls can be part of a single unit of work. The maximum number of messages within a unit of work can be controlled by the DEFINE MAXSMSGS command on z/OS, or by the MAXUMSGS attribute of the ALTER QMGR command on other platforms. See WebSphere MQ Script (MQSC) Command Reference for details of these commands.
To help handle units of work, WebSphere MQ provides the BackoutCount attribute. This is incremented each time a message, within a unit of work, is backed out. If the message repeatedly causes the unit of work to abend, the value of the BackoutCount finally exceeds that of the BackoutThreshold. This value is set when the queue is defined. In this situation, the application can choose to remove the message from the unit of work and put it onto another queue, as defined in BackoutRequeueQName. When the message is moved, the unit of work can commit.
This chapter introduces committing and backing out units of work, under these headings: