Switch load files
The switch load file is a shared library (a DLL on Windows systems) that is loaded by the code in the IBM MQ application and the queue manager. Its purpose is to simplify the loading of the database's client shared library, and to return the pointers to the XA functions.
The details of the switch load file must be specified before the queue manager is started. The details are placed in the qm.ini file on Windows, UNIX and Linux systems.
- On Windows and Linux (x86 and x86-64 platforms) systems, use the IBM MQ Explorer to update the qm.ini file.
- On all other systems edit the file, qm.ini, directly.
The C source for the switch load file is supplied with the IBM MQ installation if it supports Scenario 1 global units of work. The source contains a function called MQStart. When the switch load file is loaded, the queue manager calls this function, which returns the address of a structure called an XA switch.
The XA switch structure exists in the database client shared library, and contains a number of function pointers, as described in Table 1:During the first MQBEGIN call in the application, the IBM MQ code that executes as part of MQBEGIN loads the switch load file, and calls the xa_open function in the database shared library. Similarly, during queue manager startup, and on other subsequent occasions, some queue manager processes load the switch load file and call xa_open.
Function pointer name XA function Purpose xa_open_entry xa_open Connect to database xa_close_entry xa_close Disconnect from database xa_start_entry xa_start Start a branch of a global unit of work xa_end_entry xa_end Suspend a branch of a global unit of work xa_rollback_entry xa_rollback Roll back a branch of a global unit of work xa_prepare_entry xa_prepare Prepare to commit a branch of a global unit of work xa_commit_entry xa_commit Commit a branch of a global unit of work xa_recover_entry xa_recover Discover from the database whether it has an in-doubt unit of work xa_forget_entry xa_forget Allow a database to forget a branch of a global unit of work xa_complete_entry xa_complete Complete a branch of a global unit of work We can reduce the number of xa_* calls by using dynamic registration. For a complete description of this optimization technique, see XA dynamic registration.
Parent topic: Database coordination