Share via


Create and Attach Rules to Triggers

Applies To: Windows Server 2008

Use this procedure to create and attach rules to Message Queuing triggers.

You can use this procedure to create and attach rules to Message Queuing triggers. Create and attach rules to specify the action that will be taken when a specific condition or set of conditions is true.

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

To create and attach rules to 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 Rules.

    Where?

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

  4. On the first page of the New Rule dialog box, in Rule name, type a name for the new rule, and in Rule description, type an optional description.

  5. Click Next.

  6. In New condition, enter a condition by selecting the initial string in the list box, typing the applicable final string in the Filter value/string text box below, and clicking Add. The complete condition then appears in Condition list. You can create additional conditions by repeating this operation.

  7. When you finish creating the conditions that you want to create, click Next.

  8. To specify whether the trigger will invoke a stand-alone executable or a COM component (the default), click the applicable button.

  9. To specify that the trigger invoke a COM component, in COM component invocation, select Invoke COM component. In Component ProgID, type the ID of the COM component, and in Method name, type the name of the method.

  10. To specify that the trigger invoke a stand-alone executable, in Standalone executable invocation, select Invoke standalone executable(EXE). In Executable path, type the full path of the executable file.

  11. To add parameters for either a COM component or a stand-alone executable, click Parameters. Select a parameter in the Parameter list box. If the parameter is a numeric literal or a string literal, type its value in Literal value. Click Add to add the parameter to the Invocation parameters list. Repeat this operation for each parameter that you want to add, and use the Up and Down buttons to change the order in which the parameters are transferred to the program. Click OK, and then click Finish.

  12. To attach existing rules to a trigger, do the following:

    • In the console tree, click Triggers.

      Console tree location is: Computer Management/Services and Applications/Message Queuing/Triggers/Triggers

      Or, click Triggers under the applicable monitored queue.

      Console tree location is: Computer Management/Services and Applications/Message Queuing/ YourQueueFolder (Public Queues, Private Queues, or System Queues)/ YourMonitoredQueue/Triggers

  13. In the details pane, right-click the applicable trigger, click Properties, and then click the Attached Rules tab. Select the rule you want to attach to the trigger from the Rules list, and then click Attach to move it to the Attached Rules list. Then click OK.

Additional considerations

  • All the rules created on the local computer, which is called the rule set, are listed in the details pane of the Computer Management snap-in when Rules is selected in the console tree.

  • A rule is composed of one or more conditions and an action that is executed when the conditions are true. Each condition is applied to a message when it arrives at the monitored queue, and the result is either true or false. After being created, the conditions applied to a particular rule are listed in Condition list on the second page of the New Rule dialog box as well as on the Conditions page of the Properties dialog box for that rule. A condition can be eliminated from this list by selecting it and clicking Remove. Multiple conditions must all be true for an action to be executed. If no condition is specified, a true value will always be returned. This is useful when you want a trigger to fire unconditionally every time a message arrives at the monitored queue.

  • The actions performed when a condition is true are expressed either in the form of an executable file and parameters (arguments) or in the form of a COM component, a method, and parameters. You can also invoke other types of files by making them parameters of an .exe file. For example, you can invoke an .msc file by specifying mmc.exe as the executable file and including the full path of the .msc file as an invocation parameter of the string literal type. You can specify one or more parameters to be passed per action. The supported parameters are listed in the list box on the Invocation Parameters dialog box.

  • If your trigger invokes an executable file with command-line arguments, these arguments can be included as parameters of the string literal type. However, you must add a separate parameter for each command-line argument.

  • You can attach multiple rules to a trigger. In this case, the rules are executed in the order in which they are displayed on the Attached Rules page of the Properties dialog box for that rule. You can change the priority (running order) of the rules in the list. To do so, use the Up and Down buttons on this page to change the order of priority of each rule as needed to give the rule a higher or lower priority, respectively. You can also detach rules on this page by selecting each rule that you want to detach and clicking Detach. For more information, see Additional references.

Additional references