Home
WebSphere MQ for Windows server, WebSphere MQ client for Windows
The exit is a DLL that must be written in C.
- On a WebSphere MQ for Windows server, specify the path name of the directory that holds the exit program on the Exits page of the queue manager properties (accessed from the WebSphere MQ Services snap-in).
If the exit is on a Windows client, specify the path name on the All Queue Managers page of the WebSphere MQ properties (accessed from the WebSphere MQ services snap-in).
The WebSphere MQ Services snap-in is described in the WebSphere MQ System Administration Guide manual.
The default exit path is c:\\IBM\Websphere MQ\exits. The actual location is set by the following registry setting:
HKEY_LOCAL_MACHINE\SOFTWARE\IBM\MQSeries\CurrentVersion\Configuration\ ClientExitPath\ExitsDefaultPathWe can override this value by specifying a full path name on the DEFINE CHANNEL command.
Define a dummy MQStart() routine in the exit and specify MQStart as the entry point in the library. Figure 1 shows how to set up an entry to your program:
Figure 1. Sample source code for a channel exit on Windows#include <cmqc.h> #include <cmqxc.h> void MQStart() {;} /* dummy entry point - for consistency only */ void MQENTRY ChannelExit ( PMQCXP pChannelExitParms, PMQCD pChannelDefinition, PMQLONG pDataLength, PMQLONG pAgentBufferLength, PMQVOID pAgentBuffer, PMQLONG pExitBufferLength, PMQPTR pExitBufferAddr) { … Insert code here }In order to access the fields pointed to by pChannelExitParms and pChannelDefinition we need to insert the following lines in your exit program:
⋮ /* Variable definitions */ ⋮ PMQCXP pParms; PMQCD pChDef; ⋮ /* Code */ ⋮ pParms = (PMQCXP)pChannelExitParms; pChDef = (PMQCD)pChannelDefinition;The pointers pParms and pChDef can then be dereferenced to access individual fields.
When writing channel exits for these products using Visual C++, you should do the following:
- Add MQMVX.LIB to project as a source file1.
- Change the box labelled "Use Run-Time Library" from "Multithreaded" to "Multithreaded using DLL" in the project settings under C/C++ code generation.
- Do not change the box labelled "Entry-Point Symbol". This box can be found in the project settings, under the Link tab, when you select Category and then Output.
- Write your own .DEF file; an example of this is shown in Figure 2.
Figure 2. Sample DEF file for WindowsLIBRARY exit PROTMODE DESCRIPTION 'Provides Retry and Channel exits' CODE SHARED LOADONCALL DATA NONSHARED MULTIPLE HEAPSIZE 4096 STACKSIZE 8192 EXPORTS Retry
Parent topic:
Writing and compiling channel-exit programs1 MQMVX.LIB is used for data conversion and is not available
ic17670_
Home