runmqdnm, endmqdnm" /> Use the .NET Monitor

 

Using the .NET Monitor

The .NET Monitor is an application similar to a WebSphere MQ trigger monitor. We can create .NET components which will be instantiated whenever a message is received on a monitored queue, and which will then process that message. The .NET Monitor is started by the runmqdnm command and stopped by the endmqdnm command. For details of these commands, see WebSphere MQ System Administration Guide.

To use the .NET Monitor, you write a component that implements the IMQObjectTrigger interface, which is defined in amqmdnm.dll.

Components can be either transactional or non-transactional. A transactional component must inherit from System.EnterpriseServices.ServicedComponent and be registered as either RequiresTransaction or SupportsTransaction. It must not be registered as RequiresNew as the .NET Monitor will already have initiated a transaction.

The component receives MQQueueManager, MQQueue, and MQMessage objects from runmqdnm. It may also receive a User Parameter string if one was specified, using the -u command line option, when runmqdnm was invoked. Note that your component receives the contents of a message that arrived on the monitored queue in an MQMessage object. It does not have to connect to the queue manager, open the queue or get the message itself. The component must then process the message as appropriate and return control to the .NET Monitor.

If your component has been written as a transactional component, it registers whether it wishes to commit or rollback the transaction using the facilities provided by System.EnterpriseServices.ServicedComponent.

As the component receives MQQueueManager and MQQueue objects as well as the message, it has complete context information for that message and can, for example, open another queue on the same queue manager without needing to separately connect to WebSphere MQ.


monitor