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:
  1. Configure the queue manager:
    • [UNIX][Linux]On UNIX and Linux® systems add a stanza like this to the qm.ini file:
      
      PublishSubscribe:
      PublishExitPath=Module
      PublishExitFunction=EntryPoint
      
      where the module is MQ_INSTALLATION_PATH/samp/bin/amqspse. MQ_INSTALLATION_PATH represents the high-level directory in which IBM® MQ is installed.
    • [Windows]On Windows set the equivalent attributes in the registry.
  2. Make sure the Module is accessible to IBM MQ.
  3. Restart the queue manager to pick up the configuration.
  4. In the application process to be traced, describe where the trace files should be written to. For example:
    • [UNIX][Linux]On UNIX and Linux systems, ensure that the directory /var/mqm/trace exists and export the following environment variable:
      
      export MQPSE_TRACE_LOGFILE=/var/mqm/trace/PubTrace
      
    • [Windows]On Windows, ensure that the directory C:\temp exists and set the following environment variable:
      
      set MQPSE_TRACE_LOGFILE=C:\temp\PubTrace