The Publish Exit sample program
AMQSPSE0 is a sample C program of an exit to intercept a publication before it is delivered to a subscriber. The exit can then, for example, alter the message headers, payload or destination, or prevent the message being published to a subscriber.
To run the sample, perform the following tasks:
- Configure the queue manager:
![[AIX]](ngaix.gif)
On AIX® and Linux® systems add a
stanza like this to the qm.inifile:
where the module isPublishSubscribe: PublishExitPath=Module PublishExitFunction=EntryPointMQ_INSTALLATION_PATH/samp/bin/amqspse. MQ_INSTALLATION_PATH represents the high-level directory in which IBM® MQ is installed.
On Windows set the equivalent
attributes in the registry.
- Make sure the Module is accessible to IBM MQ.
- Restart the queue manager to pick up the configuration.
- In the application process to be traced, describe where the trace files should be written to. For example:
![[AIX]](ngaix.gif)
On AIX and Linux systems,
ensure that the directory /var/mqm/traceexists and export the MQPSE_TRACE_LOGFILE environment variable:export MQPSE_TRACE_LOGFILE=/var/mqm/trace/PubTrace
On Windows, ensure that the
directory C:\tempexists and set the MQPSE_TRACE_LOGFILE environment variable:set MQPSE_TRACE_LOGFILE=C:\temp\PubTrace