Create and Attach Rules to Triggers
A rule is composed of one or more conditions and an action that is taken 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. Multiple conditions must all be true for an action to be taken.
If no condition is specified, a true value is always returned. This is useful when you want a trigger to fire unconditionally every time a message arrives at the monitored queue.
Creating and attaching rules to triggers
To create and attach rules to triggers
Open Computer Management.
In the console tree, right-click Rules.
- Computer Management/Services and Applications/Message Queuing/Triggers/Rules
Point to New, and then click Rule.
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.
In the Condition list box under New condition, enter a condition by clicking the applicable initial string in the list box, typing the applicable final string in the Filter value/string text box below the list box, and then clicking Add. The complete condition then appears in Condition list. You can create additional conditions by repeating this operation.
When you finish creating the conditions that you want to create, click Next.
To make the trigger invoke a Component Object Model (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.
To make the trigger invoke a standalone executable file, in Standalone executable invocation, select Invoke standalone executable (EXE). In Executable path, type the full path of the executable file.
To add parameters for either a COM component or a standalone executable file, click Parameters. Click a parameter in the Parameter list box. If the parameter is a numeric literal or a string literal, type its value in Literal value. To add the parameter to the Invocation parameters list, click Add. 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.
To attach existing rules to a trigger, do the following:
In the console tree, click Triggers.
Computer Management/Services and Applications/Message Queuing/Triggers
– or –
Click Triggers under the applicable monitored queue.
- Computer Management/Services and Applications/Message Queuing/YourQueueFolder (Public Queues, Private Queues, or System Queues)/YourMonitoredQueue/Triggers
In the details pane, right-click the applicable trigger, click Properties, and then click the Attached Rules tab. Click the rule you want to attach to the trigger from the Rules list, click Attach to move it to the Attached Rules list, and then click OK.
To open Computer Management on Windows Vista®, click Start, right-click Computer, and then click Manage.
To open Computer Management on Windows Server® 2008, click Start, point to Programs, point to Administrative Tools, and then click Computer Management.
All the rules created on the local computer are listed in the details pane of Computer Management when you click Rules in the console tree.
You can attach multiple rules to a trigger. In this case, the rules are run 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 (order of execution) of the rules in the list. To do so, use the Up and Down buttons as needed to give the rule a higher or lower priority, respectively. You can also detach rules by clicking each rule that you want to detach, and then clicking Detach.