11
Triggerin g From Console Triggering: The queue manager defines certain conditions as constituting “trigger events”. If triggering is enabled for a queue and a trigger event occurs, the queue manager sends a trigger message to a queue called an initiation queue. The  presence of the trigger message on the initiation queue indicates that a trigger event has occurred. The following diagram will describe the process of the triggering. 1. Program A issues an MQPUT and puts a message into A-Q for Program B.

20345723 Triggering From Console

Embed Size (px)

Citation preview

Page 1: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 1/11

Triggering From Console

Triggering:

The queue manager defines certain conditions as constituting “trigger events”.If triggering is enabled for a queue and a trigger event occurs, the queuemanager sends a trigger message to a queue called an initiation queue. The

presence of the trigger message on the initiation queue indicates that atrigger event has occurred.

The following diagram will describe the process of the triggering.

1. Program A issues an MQPUT and puts a message into A-Q for Program B.

Page 2: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 2/11

2. The queue manager processes this API call and puts the message into theapplication queue.

3. It also finds out that the queue is triggered. It creates a trigger messageand looks in the Process Definition to find the name of the application and puts it in the trigger message. The trigger message is put into theinitiation queue.

4. The trigger monitor gets the trigger message from the initiation queue andstarts the program specified.

5. The application program starts running and issues an MQGET to retrievethe message from the application queue.

Process definition:

A process definition object defines an application that starts in response to atrigger event on a Web Sphere MQ queue manager.

Initiation queue:

Defining an initiation queue when a trigger event occurs, the queue manager puts a trigger message on the initiation queue specified in the applicationqueue definition. Initiation queues have no special settings .

To do this task, we’ve to create a Queue Manager and two localqueues and a process definition.

Page 3: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 3/11

First, Create a Queue Manager from the console.The command for Create a Queue Manager is “crtmqmq (Queue Manager

Name)

After creating the Queue Manager, we’ve to start. The command to start theQueue Manager is “strmqm (Queue Manager Name)

Page 4: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 4/11

Type “runmqsc (Queue Manager Name) to do the Manipulations inside theQueue Manager Objects.

Now create Local Queues in Queue Manager.To create a Local Queue type, “DEFINE QLOCAL (Queue Name)

Page 5: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 5/11

Page 6: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 6/11

Page 7: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 7/11

To set the Trigger Type Property for the Local queue, type “ ALTER QLOCAL (Queue Name) TRIGTYPE(Every or First or None)

To set the Trigger “ON”, Type “ALTER QLOCAL (Queue Name)TRIGGER.

Page 8: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 8/11

To set the Initiation Queue, type “ALTER QLOCAL (Queue Name) INITQ(Queue Name).

And at last to set the Process name property, type “ ALTER QLOCAL(Queue Name) PROCESS (Process Name).

Page 9: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 9/11

Use the runmqtrm command to invoke a trigger monitor.Type “runmqtrm –q Initiation Queue Name –m Queue Manager Name.

Now it’ll wait for a trigger message.

To put the message in the Local Queue, type “ amqsput Queue Name QueueManager Name.Type the Message and press Enter.

Page 10: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 10/11

Now the Trigger will invoke the Process.And the batch file will be executed.Here we specified in the batch file is to run a “Notepad” Application.We can run any application (java) in this batch file.

Page 11: 20345723 Triggering From Console

8/8/2019 20345723 Triggering From Console

http://slidepdf.com/reader/full/20345723-triggering-from-console 11/11

So the “Notepad” will open when the queue depth is increased.