Subscribing to and Sending Remote Cache Events
If a Windows Media server is acting as an origin server, it can receive cache proxy event notifications from a downstream server. If it is acting as a proxy server, it can send event notifications to an origin server. The following table lists the available remote cache proxy events. The constants are defined in the WMS_CACHE_REMOTE_EVENT_FLAGS enumeration type.
Event |
Description |
---|---|
WMS_EVENT_REMOTE_CACHE_OPEN |
A client opened a connection to a cache proxy server. |
WMS_EVENT_REMOTE_CACHE_CLOSE |
A client closed a connection to a cache proxy server. |
WMS_EVENT_REMOTE_CACHE_LOG |
A client submitted a rendering log to indicate that it streamed content from a local cache, or a cache proxy server submitted a remote log to indicate that it either streamed content from cache or proxied it from an upstream server. |
You can create a logging plug-in on the origin server to trap the events raised by a downstream proxy server and monitor the responses of the proxy to client requests. Content providers can use this information to determine how often their content is being accessed.
Requesting Remote Events (Origin Server)
To trap a remote event, you must create an event notification plug-in for the origin server. The server calls GetHandledEvents on the IWMSEventNotificationPlugin interface to retrieve an array of the events handled by the plug-in. If no event notification plug-in registers to receive remote cache events, the origin server ignores all remote cache event notices, including cache logging notices, from downstream servers. For more information about writing custom cache plug-ins, see Creating Event Notification Plug-ins.
When a cache proxy plug-in on a remote server calls either the GetContentInformation method or the CompareContentInformation method on the IWMSCacheProxyServer interface, the remote server calls the origin server to retrieve the content information requested by the plug-in. The origin server returns an event request, and the remote server calls either OnGetContentInformation or OnCompareContentInformation on IWMSCacheProxyServerCallback and places the event request in the WMS_CACHE_CONTENT_INFORMATION_EVENT_SUBSCRIPTIONS value of the cache content information context. The remote server can query this value and compare it to the WMS_CACHE_REMOTE_EVENT_FLAGS enumeration to determine what remote events have been requested.
Sending Remote Events (Remote Cache Proxy Server)
The remote proxy server automatically sends event notices. The notices must not be modified by upstream cache proxy servers before they reach the origin server. Also, intervening servers do not raise internal events when they receive a notice from the remote server.
See Also (General)
See Also (Visual Basic .NET)
IWMSCacheProxyServer.CompareContentInformationIWMSCacheProxyServer.CompareContentInformation (Visual Basic .NET)
IWMSCacheProxyServer.GetContentInformationIWMSCacheProxyServer.GetContentInformation (Visual Basic .NET)
IWMSCacheProxyServerCallback.OnCompareContentInformationIWMSCacheProxyServerCallback.OnCompareContentInformation (Visual Basic .NET)
IWMSCacheProxyServerCallback.OnGetContentInformationIWMSCacheProxyServerCallback.OnGetContentInformation (Visual Basic .NET)
IWMSEventNotificationPlugin.GetHandledEventsIWMSEventNotificationPlugin.GetHandledEvents (Visual Basic .NET)
See Also (C#)
IWMSCacheProxyServer.CompareContentInformationIWMSCacheProxyServer.CompareContentInformation (C#)
IWMSCacheProxyServer.GetContentInformationIWMSCacheProxyServer.GetContentInformation (C#)
IWMSCacheProxyServerCallback.OnCompareContentInformationIWMSCacheProxyServerCallback.OnCompareContentInformation (C#)
IWMSCacheProxyServerCallback.OnGetContentInformationIWMSCacheProxyServerCallback.OnGetContentInformation (C#)
IWMSEventNotificationPlugin.GetHandledEventsIWMSEventNotificationPlugin.GetHandledEvents (C#)
See Also (C++)
IWMSCacheProxyServer::CompareContentInformation
IWMSCacheProxyServer::GetContentInformation
IWMSCacheProxyServerCallback::OnCompareContentInformation
IWMSCacheProxyServerCallback::OnGetContentInformation
IWMSEventNotificationPlugin::GetHandledEvents