Prerequisites for triggering
Use this information to learn about the steps to take before using triggering.
- Either:
-
Create an initiation queue for your application queue. For
example:
orDEFINE QLOCAL (initiation.queue) REPLACE + LIKE (SYSTEM.DEFAULT.INITIATION.QUEUE) + DESCR ('initiation queue description') - Determine the name of a local queue that exists and can be used by your application (typically, this name is SYSTEM.DEFAULT.INITIATION.QUEUE or, if you are starting channels with triggers, SYSTEM.CHANNEL.INITQ), and specify its name in the
InitiationQNamefield of the application queue.
-
Create an initiation queue for your application queue. For
example:
- Associate the initiation queue with the application queue. A queue manager can own more than one
initiation queue. You might want some of your application queues to be served by different programs,
in which case, you can use one initiation queue for each serving program, although you do not have
to. Here is an example of how to create an application queue:
DEFINE QLOCAL (application.queue) REPLACE + LIKE (SYSTEM.DEFAULT.LOCAL.QUEUE) + DESCR ('appl queue description') + INITQ (initiation.queue) + PROCESS (process.name) + TRIGGER + TRIGTYPE (FIRST)
Here is an extract from a CL program for IBM® MQ for IBM i that creates an initiation queue: /* Queue used by AMQSINQA */ CRTMQMQ QNAME('SYSTEM.SAMPLE.INQ') + QTYPE(*LCL) REPLACE(*YES) + MQMNAME + TEXT('queue for AMQSINQA') + SHARE(*YES) /* Shareable */+ DFTMSGPST(*YES)/* Persistent messages OK */+ + TRGENBL(*YES) /* Trigger control on */+ TRGTYPE(*FIRST)/* Trigger on first message*/+ PRCNAME('SYSTEM.SAMPLE.INQPROCESS') + INITQNAME('SYSTEM.SAMPLE.TRIGGER') - If you are triggering an application, create a process definition object to contain information relating to the application that is to serve your application queue. For example, to trigger-start a CICS® payroll transaction called PAYR:
DEFINE PROCESS (process.name) + REPLACE + DESCR ('process description') + APPLICID ('PAYR') + APPLTYPE (CICS) + USERDATA ('Payroll data')
Here is an extract from a CL program for IBM MQ for IBM i that creates a process definition object:
/* Process definition */ CRTMQMPRC PRCNAME('SYSTEM.SAMPLE.INQPROCESS') + REPLACE(*YES) + MQMNAME + TEXT('trigger process for AMQSINQA') + ENVDATA('JOBPTY(3)') /* Submit parameter */+ APPID('AMQSINQA') /* Program name */When the queue manager creates a trigger message, it copies information from the attributes of the process definition object into the trigger message.
Platform To create a process definition object AIX®, Linux®, and Windows systems Use DEFINE PROCESS or use SYSTEM.DEFAULT.PROCESS and modify using ALTER PROCESS
z/OS®
Use DEFINE PROCESS (see sample code in step 3 ), or use the operations and control panels.
IBM i
Use a CL program containing code as in step 3. - Optional: Create a transmission queue definition and use blanks for the ProcessName attribute.
The TrigData attribute can contain the name of the channel to be triggered or it can be left blank. Except on IBM MQ for z/OS, if it is left blank, the channel initiator searches the channel definition files until it finds a channel that is associated with the named transmission queue. When the queue manager creates a trigger message, it copies information from the TrigData attribute of the transmission queue definition into the trigger message.
- If you have created a process definition object to specify properties of the application that is to serve your application queue, associate the process object with your application queue by naming it in the ProcessName attribute of the queue.
Platform Use commands AIX, Linux, and Windows systems ALTER QLOCAL
z/OS
ALTER QLOCAL
IBM i
CHGMQMQ - Start instances of the trigger monitors
(or trigger servers in IBM MQ for IBM i ) that are to serve the initiation queues you have defined. See Initiation queue processing by trigger monitors for more information.
If you want to be aware of any undelivered trigger messages, make sure that your queue manager has a dead-letter (undelivered-message) queue defined. Specify the name of the queue in the DeadLetterQName queue manager field.
You can then set the trigger conditions that you require, using the attributes of the queue object that defines your application queue. For more information, see Controlling trigger events.