COM+ is an evolution of Microsoft Component Object Model (COM) and Microsoft Transaction Server (MTS). COM+ builds on and extends applications written using COM, MTS, and other COM-based technologies.
Size: 2.83 MB
Language: en
Added: Mar 12, 2025
Slides: 37 pages
Slide Content
COM+ EVENTS
LATE-BOUNDDELIVERYOF
INFORMATION
Computer Call
April 08, 1999
PUBLISHING INFORMATION
•One of the classic programming problems of distributed
computing is how to advertise and deliver information to
one or more interested parties without a priori knowledge
of their identity
•In this context there are only two types of programs:
those who possess info, and those who need it
Application client
IStockEvents
Component
THE COMPONENT PROGRAMMING MODEL
(REQUEST/REPLY)
•Early bound
•Class Identity (CLSID) usually compiled in
•1 : 1
•Client calls a single component
•Blocking
•Client thread generally blocks until
the call completes
Subscriber
Publisher
PUBLISH/SUBSCRIBE SYSTEMS
(PUSH)
•Late bound
•Subscriber identity not known at development time
•1 : many
•“Events” are sent to all registered subscribers
•Non-blocking
•Publishers generally do not wait
for a response from subscribers
Subscriber
Subscriber
COM EVENTS TODAY
(CONNECTION POINTS)
•No activation
•Shared life-cycles between publisher
and subscriber
•Interface-only (no implementation)
•Binding, dispatching, error semantic,
etc., left to developer
•Subscriptions aren’t persistent
•No opportunity for interception between publisher and subscriber
option explicit
' --------------------------------------------------
' Call a simple component
' --------------------------------------------------
Dim obj
set obj = CreateObject(”StockComponent.1")
obj.StockPriceChange ”MSFT", 185.00
set obj = Nothing
COM+ PROGRAMMING MODEL
•Simple programming model
•Create Object, Invoke method, Release
Client
IStockEvents
StockComponent.1
option explicit
' ------------------------------------------
' Fire an event
' ------------------------------------------
Dim obj
set obj = CreateObject(”StockEvents.1")
obj.StockPriceChange ”MSFT", 185.00
set obj = Nothing
COM EVENTS
PROGRAMMING MODEL
•Same basic programming model
•Create Object, Invoke method, Release
Subscriber
Publisher
IStockEvents
Event class
(StockEvents.1)
IStockEvents
IStockEvents
IStockEvents
Subscriber
Subscriber
EVENT CLASS AS INTERMEDIARY
•Indirection between the publisher
and subscriber
•Meta-data defined (CLSID, ProgID, IID)
•Requires no coding on part of developer
•Exposes arbitrary interface
•May be Secured to control event delivery
•Subscriptions are wired to methods within the EventClass’ firing
interface
TRANSFORMATIONS VIA
THE “EVENTCLASS”
•Introduction of the EventClass caused two transformations:
•Ordinary, vanilla COM client
became a publisher
•Ordinary, vanilla COM component became a subscriber
•Publisher = COM client
•Subscriber = COM component
EVENT CLASS INTERFACE
EXAMPLE
interface IStockEvents
{
HRESULT StockPriceChange ( BSTR StockSymbol, double Price );
HRESULT NewStock ( BSTR StockSymbol, BSTR CompanyName );
HRESULT StockSymbolChanged (BSTR OldSymbol,
BSTR NewSymbol );
HRESULT DowJonesUpdate ( double Current );
};
•Each method may have 0 - n subscriptions
•Subscribers expose this interface as well
You subscribe
to individual
methods on the
firing interface
IStockEvents
StockEvents.1
{ 877E7998-E8EC-11D1-B994-00C04F990088 }
option explicit
Dim EventSystem
Dim EventClass
set EventSystem = CreateObject("EventSystem.EventSystem")
' ----------------------------------------------
' Subscription for IStockEvents.StockPriceChange
' ----------------------------------------------
set EventClass = CreateObject("EventSystem.EventClass")
EventClass.EventClassID = "{58A7E1A1-5A4A-11d2-BD11-0080C72B9899}"
EventClass.EventClassName = "StockEvents"
EventClass.FiringInterfaceID = "{58A7E1A2-5A4A-11d2-BD11-0080C72B9899}"
EventSystem.Store "EventSystem.EventClass", EventClass
Set EventClass = Nothing
CREATING AN EVENTCLASS
Subscribers
COM EVENTS
FIRING
Publisher
EventClass
IStockEvents IStockEvents
HOW DO I SUBSCRIBE?
•Traditionally:
•Subscriber gives pointer to
self to a publisher
•This is problematic!
•Lifecycles must be shared
•Assumes one publisher of the event
•Adds complexity to subscriber
•Subscriber now “knows about”
the publisher
•Subscriber includes subscription
building logic
Subscriber
(Start-up)
Publisher
(Start-up)
Time
Publisher
(Shutdown)
Subscriber
(Shutdown)
Subscribe
Un-Subscribe
TRADITIONAL LIFE-CYCLES
(A LA CONNECTION-POINTS)
TIGHTLY-COUPLED SUBSCRIPTIONS
•This model cannot be used if:
•Subscribers do not want to be active until the event is fired
•Subscribers want to subscribe prior to publisher start-up or installation
•Administrative management of subscriptions is required
•Publisher of event changes over time
◆A subscription is a relation composed of:
◆EventClass (IID inferred)
◆A specific method within the EventClass interface
◆A subscriber
◆May be a CLSID, moniker or an interface pointer
◆The use of CLSID solves the activation problems, but not the
life-cycle issue
Publisher
Event
class
Subscriber
StockEvents StockPriceChange StockSubscriber StockSymbol = “MSFT”
EventClass EventMethod Subscriber PublisherProperties
SUBSCRIPTION AS
A FORMAL OBJECT
SUBSCRIPTION DETAILS
•MachineName
•Used to indicate that the subscribing component must be called remotely
•Subscriber
•May be a CLSID, moniker or interface pointer
•Security
•May be Secured
•Publisher Properties
•May be used by the publisher for filtering, etc.
•Subscriber Properties
•May be used by the subscriber for filtering, forwarding, etc.
•Roaming
•Subscription follows the user (owner)
Publisher
Event
class
Subscriber
COM+ Events
Subscription
DECOUPLING THE LIFE-CYCLES
•Achieving independent life-cycles requires that a third-party become involved: COM+
events
•Subscribers add subscriptions to COM+ events
•Publisher’s EventClass retrieves subscriptions from
COM+ events
Subscriptions
SURVIVING SYSTEM FAILURES
•Ensuring subscriptions survive software failures requires persistence
•COM+ Events stores subscriptions
in a database
Publisher
Event
class
Subscriber
COM+ Events
Subscription
FORMALIZING THE ROLE OF
“SUBSCRIPTION BUILDER”
•Most publish/subscribe models do not delineate between:
•Subscribers
•Subscription builders
•Subscriber = Component which receives an event call
•Subscription Builder = Entity that registers the subscriber to receive
the event
StockEvents StockPriceChangeStockTicker
COM EVENTS - WIRING
COM+ Events
Subscription
Dim EventSystem
Dim EventSubscription
set EventSystem = CreateObject("EventSystem.EventSystem")
' ----------------------------------------------
' Subscription for IStockEvents.StockPriceChange
' ----------------------------------------------
set EventSubscription = CreateObject("EventSystem.EventSubscription")
EventSubscription.SubscriptionID = "{0019B161-69D9-11D1-88D1-0080C7D771BF}"
EventSubscription.SubscriptionName= "ESSample.StockPriceChange"
EventSubscription.EventClassID = "{F89859D1-6565-11D1-88C8-0080C7D771BF}"
EventSubscription.MethodName = "StockPriceChange"
EventSubscription.SubscriberCLSID = "{C658CAB0-89A2-11D1-891C-0080C7D771BF}"
'EventSubscription.PutPublisherProperty "StockSymbol", "MSFT"
EventSystem.Store "EventSystem.EventSubscription", EventSubscription
Set EventSubscription = Nothing
CREATING A SUBSCRIPTION
SUBSCRIPTION SUMMARY
•Subscriptions as objects are more expressive than mere
“object pointers”
•Subscriptions are added to COM+ events
•Subscriptions are managed by COM+ events
•Subscriptions are persisted by COM+ events
•Subscriptions may be queried
•Subscriptions may be secured
•Subscriptions may be shared by multiple publishers
(instances)
•Publishers and subscribers
•May be uncoupled
•Need not share life-cycles
NT Service
Firing
Subscribers
IStockEvents
IStockEvents
EventClass
Wiring
COM EVENTS
OVERALL ARCHITECTURE
Subscriptions
StockEvents StockPriceChangeStockTicker
Subscription
Event service
Subscriptions
Event store
COM EVENTS
FIRING
Subscribers
IStockEvents
IStockEvents
EventClass
Publisher
COM EVENTS
FIRING Subscribers
IStockEvents
IStockEvents
EventClass
Publishers
Subscription
cache
Event service
Subscriptions
Event store
◆Publishers cache subscriptions
⚫Cache is kept coherent with Event
Store automatically
⚫Cache may contain
private subscriptions
Publisher
Event class
Subscribers
“MSFT”
“CPQ”
“INTC”
interface IStockEvents
{
HRESULT StockPriceChange ( BSTR StockSymbol, double Price );
};
EVENT FILTERING
•Most Subscribers will want to be called only when a specific stock price
changes
•This requires filtering
Publisher Subscribers
IStockEvents IStockEvents
EventClass
Event service
Event store
EventFilter
Subscription
cache
interface IStockEvents
{
HRESULT StockPriceChange ( BSTR StockSymbol, double Price );
};
Subscription
EventClassMethodSubscriberStockSymbol = “MSFT”
COM EVENTS
FILTERING IN PUBLISHER
Publisher
Subscribers
IStockEvents
IStockEvents
EventClass
Event service
Subscriptions
Event store
EventFilter
Subscription
Cache
COM EVENTS
FIRING (CUSTOM CACHE)
Publisher process
Stock events
IStockEvents
Subscriber
Subscriber
Subscriber
Machine 1
Machine 2
IStockEvents
IStockEvents
Subscriber process
Subscriber process
REMOTEABLE EVENTS
COM+ EVENTS STORE
•Component-based
•Load balancing, security, transactions
•Secure
•Accessible via Windows NT
®
service
(COM+ event system)
•Publishes events
•EventObject added, modified, deleted
•Not required for firing events
COM+ EVENTS SECURITY
•Subscriber
•Subscriber components use standard COM/COM+ security to protect
against “fake” publishers
•EventClass
•COM+ role based security prevents unauthorized subscriptions from being
registered to receive secure events
•All objects in Event Store may be Secured
•Event Store
•Only accessible by Windows NT Service running as “Local system”
MS PRODUCTS IMPLEMENTING COM+
EVENTS
•SENS - System Event Notification Service
•Publishes login/logout, network connect/disconnect, Plug and Play,
shell start/end, etc.
•SyncMgr
•Subscribes to SENS and coordinates
application synchronization
•COM+
•All COM+ components fire debug/trace
events using COM+ events
•Tools
•Support currently being added across
both our languages and tools