MSMQ Triggers Topics | Previous | Next
Triggers and their rules are displayed in, and can be managed from, the Computer Management snap-in in the Microsoft Management Console (MMC) for Windows 2000 and Windows NT 4.0. For Windows 2000, you must first expand Services and Applications and then expand Message Queuing in the console tree (usually the left pane).
Under the Triggers folder, the Trigger definitions folder and the Rule definitions folder can then be expanded to view individual trigger and rule definitions respectively. Alternatively, a queue folder can also be expanded to view related triggers and rules. Simply right-click a trigger or rule to access properties and definitions.
Note
The version of MMC required for using MSMQ Triggers with the Computer Management snap-in is version 1.1. This version is not provided with Windows NT 4.0. For information on upgrading the version of MMC you are using, see:
Microsoft Management Console Home Page.
For more information on MMC and using snap-ins, see Windows Help for MMC.
All triggers created on the local computer are displayed in the Computer Management snap-in. The left pane displays the trigger set and the rule set, while the right pane displays additional properties associated with each trigger.
Triggers can be serialized. Serialized triggers will process messages in the order in which they arrive; however, the throughput is lower than for non-serialized triggers as messages are processed one at a time. Non-serialized triggers allow for higher throughput but may not process messages in the order in which they arrive, such as when multiple messages are processed simultaneously. Multiple triggers associated with a queue must be either all serialized or all non-serialized, otherwise their behavior cannot be defined. It is recommended that you use only a single trigger with the serialized option since the order of trigger firing is random according to their GUIDs.
The following describes the various tasks associated with managing triggers on a computer.
To create a trigger
Note
Before creating a trigger, verify that the account the MSMQ Trigger Service runs under has been granted the Peek Message permission for all existing queues that will be associated with triggers.
To edit a trigger definition
To delete a trigger
All rules created on the local computer are displayed in the Computer Management snap-in. You can assign multiple rules to a trigger; in this case, the rules are executed in the order they are displayed in the rules list. You can change the priority of rules in this list. Rules displayed are disabled by default, you must select the applicable check box next to the rule to enable it for use with the trigger.
To summarize, a rule is comprised of one or more conditions, with an action executed when the condition(s) are true. The condition is applied to a message when it arrives at the monitored queue, and yields either a true or false result. Multiple conditions must all be true for an action to be executed. If no condition is specified, this will always return a true value. This is useful when you want a trigger to fire unconditionally every time a message arrives at the monitored queue. The following table lists the supported conditions.
Condition | Description |
---|---|
Message Label Contains/Does Not Contain | Tests if the label of the arrived message contains (or does not contain) the string you specified. This string is case-sensitive. |
Message Priority Equals/Not Equal/Greater Than/Less Than | Tests if the priority of the arrived message satisfies the mathematical expression you specified. |
Message AppSpecific Equals/Not Equal/Greater Than/Less Than | Tests if some application-specific numeric value satisfies the mathematical expression you specified. |
Message Body Contains/Does Not Contain | This applies only to messages in which the body type is VT_BSTR, otherwise the condition will always be false. |
Message Source Machine ID Equals/Not Equals | Tests if the source computer GUID is equal to (or does not equal) the value you specified. |
Actions taken when a condition is true are either expressed in the form of an executable file and arguments (parameters), or in the form of a COM component, method, and arguments. You can specify one or more arguments to be passed per action. The supported arguments are listed on the Action tab for the rule definitions property page.
When the action specified is in the form of a COM component, you can specify a return value that determines whether the MSMQ Trigger Service will continue processing rules or not. In this case, the return value should be of the enum type MSMQTriggerObjects::RulesProcessingStatus, and can have the values RULES_PROCESSING_CONTINUE or RULES_PROCESSING_STOP.
The following describes the various tasks associated with managing trigger rules.
To create a rule for a trigger
To change the priority of a rule for a trigger
To delete a rule
MSMQ Triggers installs with a set of default configuration values. You can change these values after installation using the Computer Management snap-in by right-clicking Triggers, clicking Properties, and then changing the values as needed.
All configuration information, as well as trigger definition information, is stored in the local registry under HKEY_LOCAL_MACHINE\Software\Microsoft\MSMQ\Triggers.
Notes