Writing an Event Consumer Provider
An event consumer provider is a component of the permanent consumer architecture that determines which permanent event consumer handles a given event. You should create an event consumer provider along with your permanent event consumers to route events properly from WMI.
An event consumer provider links an event provider with a list of consumer classes. Instances of these consumer classes then receive events from that provider. WMI identifies which consumer provider the events are delivered to, based on the __EventConsumerProviderRegistration instance, which associates the consumer provider __Win32Provider instance with a logical consumer class. Users create instances of the consumer class as part of a permanent subscription. If the event provider is not running when an event occurs, then WMI starts the provider when it needs to deliver events.
The following procedure describes how to implement an event consumer provider.
To implement an event consumer provider
- Design consumer classes in Managed Object Format (MOF) and register them with WMI. For more information, see Designing Managed Object Format (MOF) Classes.
- Implement the
IWbemProviderInit interface for your provider.
Note Event consumer providers are strongly encouraged to use the multithreading model "Both".
- Implement the
IWbemEventConsumerProvider interface for your provider.
The IWbemEventConsumerProvider interface is the primary interface for an event consumer provider.
- Supply one or more physical consumers to receive the event messages from WMI.
A physical consumer is a COM object that represents a permanent event consumer. All physical consumers must implement the IWbemUnboundObjectSink interface. For more information, see Implementing a Physical Consumer.