Create Triggers

Applies To: Windows Server 2008

You can use this procedure to create Message Queuing triggers. Create Message Queuing triggers to associate the arrival of each incoming message at a queue with a response that depends on the contents of the message and may invoke either a COM component or a stand-alone executable program.

Membership in the local Users group, or equivalent, is the minimum required to complete this procedure.

To create Message Queuing triggers

  1. Click Start, point to Run, type compmgmt.msc, and press ENTER to display the Computer Management MMC console.

  2. In the console tree, right-click Triggers.

    Where?

    • Computer Management/Services and Applications/Message Queuing/Triggers/Triggers
  3. Point to New, and then click Trigger.

  4. In Trigger name on the first page of the New Trigger dialog box, type a name for the new trigger.

  5. If you want to specify a user-defined queue as the monitored queue, in Queue path name, type the path name of the queue with which the trigger will be associated in the ComputerName\QueueName syntax, or the .\QueueName syntax for the local computer. (Do not use format names.) Otherwise, click the name of an automatically created queue on your computer.

  6. Click Peeking, Retrieval, or Transactional retrieval to specify the type of message processing.

  7. Click the applicable check box to configure the trigger as enabled or disabled.

  8. Click the applicable check box to configure the trigger as serialized or not serialized, and then click Next.

  9. On the second page of the New Trigger dialog box, to attach an existing rule to the trigger, select a rule in the Rules list, and then click Attach

  10. To remove a rule from a trigger, select a rule in the Attached Rules list, and then click Detach.

  11. To change the order in which rules are tested for the triggers, click the Up and Down buttons.

  12. When you have the list of attached rules that you want, click Finish.

Additional considerations

  • Triggers are not installed by default during Message Queuing installation. For information about installing triggers, see Installing Message Queuing Triggers.

  • This procedure can also be performed by opening the New Trigger dialog box from the Triggers folder under any monitored queue in the console tree as follows: right-click Triggers, point to New, and then click Trigger. In this case, the queue automatically becomes the monitored queue.

  • Regardless of where the creation of a trigger is initiated, all the triggers created on the local computer, which is called the trigger set, are listed in the details pane of the Computer Management snap-in when Triggers is selected in the console tree under the Triggers folder. By default, for each trigger, the following is displayed in the details pane:

    • Trigger name

    • Name of the monitored queue

    • Number of rules attached to the trigger

    • Whether the trigger is enabled

    • Whether the trigger is serialized

    • Message processing type

  • Before creating a trigger, verify that the account under which the Message Queuing Triggers service is running has been granted the Peek Message permission and the Receive Message permission for all existing queues that will be associated with triggers having the retrieval or transactional-retrieval processing type. For more information, see Additional references.

  • After you type the name of a user queue to which the trigger will be associated in Queue path name, the existence of the queue is verified. If a queue with the name typed cannot be found, an error message appears. When you create a trigger for a queue, the trigger service is automatically granted the necessary permission on the queue (assuming that the user who creates the triggers has rights to modify the queue permissions). When the last trigger is removed from a queue, this permission is revoked. However, if you delete a queue and re-create it, you must manually modify the queue permissions in order for the triggers to work with this queue.

  • Triggers can be serialized or nonserialized. A serialized trigger tests the conditions of all the rules associated with it on each message and performs all the applicable actions before moving on to the next message in the order in which the messages arrive. However, the throughput is lower than for nonserialized triggers because the messages are processed one at a time. Nonserialized triggers permit higher throughput but may fail to perform a given operation on the messages in the order in which they arrive. This occurs, for example, when multiple messages are processed simultaneously. If you create multiple triggers for a particular queue and at least one of them is serialized, all the triggers will behave as serialized triggers, even if they are not defined as serialized. Triggers with the transactional-retrieval processing type can only be serialized. If message processing order is significant, it is recommended that you use only a single trigger per queue and enable the serialized option, because the order of trigger firing is random with respect to their GUIDs.

  • By default, the Message Queuing Triggers service runs under the Network Service account. Note that when the Triggers service is running under the Network Service account, it does not interact with the desktop. If this functionality is required, you can configure the Triggers service to run under the Local System account and enable interaction with the desktop in Computer Management. For best security practice, do not change the default account to a less secure account unless absolutely necessary. The Triggers service must run under an account with administrator permissions.

  • Executable files that are invoked by triggers are invoked with the same security privileges as those assigned to the Triggers service.

  • After a trigger has been created, rules can be attached to it. For more information, see Additional references.

  • When you delete a queue, the triggers associated with that queue are not deleted. If you later re-create a queue of the same name, any existing triggers will be used by this queue. However, this re-created queue will not be monitored by the Message Queuing Triggers service until the computer is restarted, or the associated triggers disabled, and then enabled again. For instructions on setting the enabled or disabled property for a trigger, see View or Change Properties of Triggers and Rules for Triggers.

Additional references