Share via


Raising DCS WMI Events

Many DCS WMI events are raised automatically by the DCS runtime as services run and clients invoke operations. The InstrumentationProvider class provides static methods that let you raise DCS WMI events in your services. The following table lists the static methods and the WMI event that each method raises.

Note

Most of these methods are overloaded.

Method

DCS WMI Event

FireCachedEvent

CFF_CacheRefreshedEvent

FireExceptionEvent

CFF_ExceptionEvent

FireInformationEvent

CFF_InformationEvent

FireTaskActivatedEvent

CFF_TaskActivatedEvent

FireTaskDeactivatedEvent

CFF_TaskDeactivatedEvent

FireWarningEvent

CFF_WarningEvent

The following code sample raises the CFF_WarningEvent. The version of the FireWarningEvent method shown takes a string defining a warning message, and a Microsoft.ConnectedIndustry.ProcessExecution.Common.ServerContext object that contains the context information of the current request on the server. The ServerContext object contains a superset of the information in the Context object passed by a client application; it also includes the ID of the service instance, the name of the service, the ID of the task being performed, the method the task is running, and the class and assembly containing the task method. The current server context is available through the static Current property of the ServerContext class.

using Microsoft.ConnectedIndustry.ProcessExecution.Common;
using Microsoft.ConnectedIndustry.ProcessExecution.Common.Instrumentation;
...
if (InstrumentationProvider.WmiEnabled)
{
    InstrumentationProvider.FireWarningEvent("Temperature might soon exceed safety levels", ServerContext.Current);
}

See Also

The DCS Instrumentation Facility

WMI Events for DCS