[Previous] [Contents] [Next]

Chapter Eight

Connection Points

A client uses the IUnknown::QueryInterface method to discover the functionality supported by an object. The more interfaces that are common to the client and the object, the more intertwined their relationship is. But regardless of the number of interfaces the object supports, the basic model remains the same: the client calls the methods implemented by the object, the object performs the desired service, and then the object returns the results to the client. This type of relationship is rather one-sided—the client always makes requests of the object. COM+ supports connection points, a technology that enables an object to "talk back" to its client. Objects that support connection points are often called connectable objects.

An object generally uses connection points to notify the client when something interesting happens in the object's sphere; this is known as firing an event. ActiveX controls are the best-known type of the objects that use this technology to raise events in their container. Sometimes objects use connection points to get further information from the client about the service it has requested. At other times, objects use connection points to request that the client perform a service—in effect turning the tables on their relationship. Regardless of the reason for using connection points, this generic COM+ facility supports bidirectional communication between a client and an object.

Connection points involve some rather peculiar terminology, which deserves a moment of attention. A source interface, also called an outgoing interface, is an interface defined in the object but implemented by the client. A sink object, which resides within the client, is the object that implements the object's source interface. Knowing these definitions will help you understand connection points. Figure 8-1 shows the layout of these elements.

Click to view at full size.

Figure 8-1. A connectable object using a source interface to "talk back" to the client.