Share via


Message Queuing Triggers

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

Message Queuing triggers allow you to associate the arrival of incoming messages at a destination queue with the functionality of one or more COM components or stand-alone executable programs. These triggers can be used to define business rules that can be invoked when a message arrives at the queue without doing any additional programming. Application developers no longer must write any infrastructure code to provide this kind of message-handling functionality.

The Message Queuing Triggers Service

The Message Queuing Triggers service was introduced as a stand-alone service in MSMQ 2.0 and then incorporated into Message Queuing as an optional subcomponent in MSMQ 3.0. The following illustration shows how the Message Queuing Triggers service monitors a queue for incoming messages and executes an action, in the form of an executable file or COM component, when the rules of a trigger are evaluated as true.

<No Change>

The stand-alone version of the Message Queuing Triggers service consists of the following programs:

  • Mqtgsvc.exe: The Mqtgsvc.exe program is the executable file for running the service.

  • Mqtrig.dll: The Mqtrig.dll program implements the COM components used by the service. Note that these COM components are not available to the application developer.

  • Mqtrig.tlb: The Mqtrig.tlb program defines the COM components used by the service. Note that these COM components are not available to the application developer.

  • Mqtgclus.dll: The Mqtgclus.dll program defines cluster resources.

For information about downloading and installing the stand-alone version of the Message Queuing Triggers service for MSMQ 2.0, see MSMQ Triggers at the Microsoft Download Center.

The Message Queuing Triggers service can be started when Message Queuing is installed (by default, the service is not running when Message Queuing is installed) or it can be started at a later time by a Message Queuing administrator. For procedures that show how to start this service, refer to the Message Queuing online Help provided with Windows XP Professional or operating systems from the Windows Server 2003 family.

The number of triggers and rules that you can configure on a single computer is limited only by the time allowed for starting the service. The default initialization time is five minutes. If the initialization process times out before completion, an error is generated in the application log that indicates initialization failure. You can change the time-out period to accommodate large numbers of triggers and rules by setting the following registry entry.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Triggers\InitTimeout  

Set this entry to the number of milliseconds allowed for the initialization process. A value of -1 is treated as INFINITE.

Message Queuing does not provide any programmable components for starting or stopping the Message Queuing Triggers service, for creating triggers and their associated rules, or for associating existing rules with a queue. All these tasks are done by a Message Queuing administrator. Please refer to the Message Queuing online Help provided with Windows XP Professional or operating systems from the Windows Server 2003 family for the procedures for running the service and creating and managing triggers.

In MSMQ 3.0, the Message Queuing Triggers service is cluster-aware and is integrated with the active/active clustering model. For information on creating a Message Queuing Triggers resource on a virtual server in a server cluster, see the online Help provided with operating systems from the Windows Server 2003 family.

For information on See
The components of Message Queuing triggers. Trigger Components
The two types of triggers supported by the Message Queuing Triggers service. Serialized and Nonserialized Triggers
How the Message Queuing Triggers service reads messages. Reading Incoming Messages
How to create triggers and their components. Creating and Managing Triggers and Rules for Triggers

In MSMQ 4.0, the Triggers service runs as a Network Service. To use triggers in MSMQ 4.0, you must give Network Service execute and read rights on the .EXE or .DLL that is called by the trigger action, or the Triggers service fails to call the trigger.

To verify your trigger configuration:

  1. Click Start and open Control Panel, Administrative Tools, and Computer Management.

  2. Open Services and Applications, Message Queuing, Message Queuing Triggers, and Rules.

  3. For each rule, open the Properties dialog, and select the Rule Action tab.

  4. If the rule invokes an .EXE, use Windows Explorer to browse to the .EXE, open the File Properties dialog, select the Security tab, add the Network Service to Group or user names, and allow it Read & Execute permissions.

  5. If the rule invokes a COM object, use Windows Explorer to browse to the .DLL that hosts the COM object, open the File Properties dialog, select the Security tab, add the Network Service to Group or user names, and allow it Read & Execute permissions.