COM+ Event And Event Subscriber Objects
Go Up to COM basics Index
The COM+ Events system introduces a middle layer of software that decouples applications that generate events (called publishers) from applications that respond to events (called subscribers). Instead of being tightly bound to each other, publishers and subscribers can be developed, deployed and activated independently of each other.
In the COM+ Events model, an event interface is first created using the COM+ Event Object wizard. The event interface has no implementation; it simply defines the event methods that publishers will generate, and that subscribers will respond to. The COM+ event object is then installed into a COM+ Application, in the COM+ Catalog. This can be done programatically using the TComAdminCatalog object, or by a system administrator using the Component Services tool.
Event subscribers are responsible for providing an implementation for the event interface. You can create event subscriber components using the COM+ Event Subscription wizard. Using the wizard, you can select the event object you want to implement, and the IDE will stub out each method of the interface. You can also select a type library if the event object has not yet been installed in the COM+ Catalog.
Finally, once the subscriber component has been implemented, it too must be installed in the COM+ Catalog. Again, this can be done with a TComAdminCatalog object, or by using the Component Services administrative tool.
When a publisher wishes to generate an event, it simply creates an instance of the event object (not the subscriber component), and calls the appropriate methods on the event interface. COM+ then steps in and notifies all applications that have subscribed to that event object, calling them synchronously, one at a time. This way, publishers need not know anything about those applications that are subscribing to the event. Subscribers don't need anything more than an implementation of the event interface, and to select those publishers they wish to subscribe to. COM+ handles the rest.
For more information regarding the COM+ Events system, see Generating events under COM+.