SlideShare a Scribd company logo
COM+ EVENTS
LATE-BOUND DELIVERY OF
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
EVENT PROGRAMMING MODELS
• Standard event interface
• FireEvent(VARIANT StockEvent)
• Standard event object
• StockPriceChange(Event StockEvent)
• Arbitrary interface
• StockPriceChange(char* Company,
double StockPrice)
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
Admins
WHO BUILDS SUBSCRIPTIONS?
• Answer: Everyone!
Subscriptions
Publisher Subscriber
COM+ events
Subscription
set EventSub = CreateObject("EventSubscription")
EventSub.EventClassID = “...”
EventSub.MethodName = “...”
EventSub.SubscriberCLSID = “...”
EventSystem.Store(EventSub)
MMC Snap-in
Programmatic
Subscriptions
StockEvents StockPriceChange StockTicker
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 StockPriceChange StockTicker
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
EventClass Method Subscriber StockSymbol = “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”
COM+ EVENTS
COMPOSITION
• COM/COM+ features:
• Interfaces
• Transactions
• Object pooling
• Just-in-time activation
• Queued components
• Deployment
• Load balancing
• Role-based security
• Windows NT features:
• MMC-based admin
• Windows NT roaming
Publisher
Subscribers
Logger
Screen saver
(Per-user, roaming))
Emailer
IStockEvents IStockEvents
StockEvents
Event Service
Subscriptions
Event store
MAPI, SMTP
MSMQ
Audit log
Debug/trace
(Transient subscriptions)
Performance monitor
(Transient subscriptions)
STOCK TICKER SCENARIO
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

More Related Content

PPTX
Platform Events by Tim Taylor
ODP
Parallel Complex Event Processing
PPT
Notification Service 2005
PDF
AWS IoT Deep Dive
PPTX
Kafka and event driven architecture -og yatra20
PPTX
Kafka and event driven architecture -apacoug20
PDF
Microservices in AUTO1 by Alexander Egurtsov
PDF
Explained: Domain events
Platform Events by Tim Taylor
Parallel Complex Event Processing
Notification Service 2005
AWS IoT Deep Dive
Kafka and event driven architecture -og yatra20
Kafka and event driven architecture -apacoug20
Microservices in AUTO1 by Alexander Egurtsov
Explained: Domain events

Similar to COM Events for Late-bound Delivery of Information (20)

PPTX
Orion Context Broker
PPT
Syslog for SIEM using iSecurity
PPT
Missing OSS Events Powerpoint_BITUG_2006
PPTX
apidays LIVE Jakarta - Building an Event-Driven Architecture by Harin Honesty...
PPTX
Event driven architecture
PPT
Kafka-and-event-driven-architecture-OGYatra20.ppt
PPTX
Access policy consolidation for event processing systems
PDF
Solidity programming language and its different concepts with an example
PPTX
ADF and JavaScript - AMIS SIG, July 2017
PDF
Using extended events for troubleshooting sql server
PDF
Complex Event Processor 3.0.0 - An overview of upcoming features
PDF
IBM MQ - Monitoring and Managing Hybrid Messaging Environments
PDF
OpenID Foundation RISC WG Update - 2018-04-02
PDF
Extending WSO2 Analytics Platform
PDF
Actors or Not: Async Event Architectures
PPTX
Regulated Reactive - Security Considerations for Building Reactive Systems in...
PPTX
High throughput data streaming in Azure
PDF
AWS Meetup Nov 2015 - CloudTen Presentation
PDF
Cloudten aws-siem
Orion Context Broker
Syslog for SIEM using iSecurity
Missing OSS Events Powerpoint_BITUG_2006
apidays LIVE Jakarta - Building an Event-Driven Architecture by Harin Honesty...
Event driven architecture
Kafka-and-event-driven-architecture-OGYatra20.ppt
Access policy consolidation for event processing systems
Solidity programming language and its different concepts with an example
ADF and JavaScript - AMIS SIG, July 2017
Using extended events for troubleshooting sql server
Complex Event Processor 3.0.0 - An overview of upcoming features
IBM MQ - Monitoring and Managing Hybrid Messaging Environments
OpenID Foundation RISC WG Update - 2018-04-02
Extending WSO2 Analytics Platform
Actors or Not: Async Event Architectures
Regulated Reactive - Security Considerations for Building Reactive Systems in...
High throughput data streaming in Azure
AWS Meetup Nov 2015 - CloudTen Presentation
Cloudten aws-siem
Ad

More from Arun Seetharaman (14)

PDF
Implementing Load Balancing in COM+ Applications
PDF
Advanced Windows DNA Scripting with Visual InterDev
PDF
Implementing DHTML Behavior Script Components
PDF
Creating Data-based Applications Using DHTML
PDF
Understanding Windows NT Internals - Part 4
PDF
Understanding Windows NT Internals - Part 5
PDF
Understanding Windows NT Internals - Part 3
PDF
Understanding Windows NT Internals - Part 1
PDF
Understanding Windows NT Internals - Part 2
PDF
OLE DB Provider Development - Encapsulating a Service Provider
PDF
OLE DB 2.0 Architecture - Supporting Remote Data Exchange
PDF
Data Structures in Java and Introduction to Collection Framework
PDF
AWT Enhancements in V1.1 - Supporting Richer GUI Development
PDF
Java Foundation Classes - Building Portable GUIs
Implementing Load Balancing in COM+ Applications
Advanced Windows DNA Scripting with Visual InterDev
Implementing DHTML Behavior Script Components
Creating Data-based Applications Using DHTML
Understanding Windows NT Internals - Part 4
Understanding Windows NT Internals - Part 5
Understanding Windows NT Internals - Part 3
Understanding Windows NT Internals - Part 1
Understanding Windows NT Internals - Part 2
OLE DB Provider Development - Encapsulating a Service Provider
OLE DB 2.0 Architecture - Supporting Remote Data Exchange
Data Structures in Java and Introduction to Collection Framework
AWT Enhancements in V1.1 - Supporting Richer GUI Development
Java Foundation Classes - Building Portable GUIs
Ad

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Spectroscopy.pptx food analysis technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Approach and Philosophy of On baking technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Programs and apps: productivity, graphics, security and other tools
Unlocking AI with Model Context Protocol (MCP)
Spectroscopy.pptx food analysis technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Building Integrated photovoltaic BIPV_UPV.pdf
NewMind AI Weekly Chronicles - August'25-Week II
Network Security Unit 5.pdf for BCA BBA.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Approach and Philosophy of On baking technology
Per capita expenditure prediction using model stacking based on satellite ima...
Machine learning based COVID-19 study performance prediction
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
sap open course for s4hana steps from ECC to s4
Advanced methodologies resolving dimensionality complications for autism neur...
Programs and apps: productivity, graphics, security and other tools

COM Events for Late-bound Delivery of Information

  • 1. COM+ EVENTS LATE-BOUND DELIVERY OF INFORMATION Computer Call April 08, 1999
  • 2. 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
  • 3. 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
  • 4. 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
  • 5. EVENT PROGRAMMING MODELS • Standard event interface • FireEvent(VARIANT StockEvent) • Standard event object • StockPriceChange(Event StockEvent) • Arbitrary interface • StockPriceChange(char* Company, double StockPrice)
  • 6. 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
  • 7. 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
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. 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 }
  • 12. 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
  • 14. 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
  • 16. 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
  • 17. ◆ 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
  • 18. 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)
  • 19. 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
  • 20. 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
  • 21. 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
  • 22. Admins WHO BUILDS SUBSCRIPTIONS? • Answer: Everyone! Subscriptions Publisher Subscriber COM+ events Subscription
  • 23. set EventSub = CreateObject("EventSubscription") EventSub.EventClassID = “...” EventSub.MethodName = “...” EventSub.SubscriberCLSID = “...” EventSystem.Store(EventSub) MMC Snap-in Programmatic Subscriptions StockEvents StockPriceChange StockTicker COM EVENTS - WIRING COM+ Events Subscription
  • 24. 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
  • 25. 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
  • 26. NT Service Firing Subscribers IStockEvents IStockEvents EventClass Wiring COM EVENTS OVERALL ARCHITECTURE Subscriptions StockEvents StockPriceChange StockTicker Subscription
  • 27. Event service Subscriptions Event store COM EVENTS FIRING Subscribers IStockEvents IStockEvents EventClass Publisher
  • 28. 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
  • 29. 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
  • 30. Publisher Subscribers IStockEvents IStockEvents EventClass Event service Event store EventFilter Subscription cache interface IStockEvents { HRESULT StockPriceChange ( BSTR StockSymbol, double Price ); }; Subscription EventClass Method Subscriber StockSymbol = “MSFT” COM EVENTS FILTERING IN PUBLISHER
  • 31. Publisher Subscribers IStockEvents IStockEvents EventClass Event service Subscriptions Event store EventFilter Subscription Cache COM EVENTS FIRING (CUSTOM CACHE)
  • 32. Publisher process Stock events IStockEvents Subscriber Subscriber Subscriber Machine 1 Machine 2 IStockEvents IStockEvents Subscriber process Subscriber process REMOTEABLE EVENTS
  • 33. 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
  • 34. 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”
  • 35. COM+ EVENTS COMPOSITION • COM/COM+ features: • Interfaces • Transactions • Object pooling • Just-in-time activation • Queued components • Deployment • Load balancing • Role-based security • Windows NT features: • MMC-based admin • Windows NT roaming
  • 36. Publisher Subscribers Logger Screen saver (Per-user, roaming)) Emailer IStockEvents IStockEvents StockEvents Event Service Subscriptions Event store MAPI, SMTP MSMQ Audit log Debug/trace (Transient subscriptions) Performance monitor (Transient subscriptions) STOCK TICKER SCENARIO
  • 37. 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