The Monitoring Server monitors mirroring jobs. As soon as a Mirroring job is started then the Mirroring Source Server sends an event (MirroringStatusEventArgs) for the state changing of the mirroring job to the monitoring Server. A subscriber can follow mirroring states from start to end.
The following are different states of a mirroring job:
- MirroringJobInitialized is sent after a mirroring job is initialized.
- MirroringPackageInitialized is sent after a mirroring package is initialized (info about the package is also send).
- Transfering is sent during transferring of a mirroring package.
- Transferred is sent when the mirroring package is transferred.
- MirroringPackageCompleted is sent when the package has been imported.
- MirroringJobCompleted is sent when the last package is imported and the entire mirroring job is finished.
- ExportingError is sent if an error occurs during exporting.
- TransferingError is sent if an error occurs during transfer.
- ImportingError is sent if an error occurs during importing.
|MirroringStatusEventArgs||Contains a GUID which is the mirroring job ID and a MirroringTransferData.|
|MirroringTransferData||Contains MirroringInitializeData, MirroringPackageBody, MirroringPackageHeader and MirroringStatus.|
|MirroringInitializeData||Contains Name, DestinationPageGuid, DestinationPath, DestinationRoot, LastExecution, NrOfFilesinPackage, NrOfPagesInPackages etc.|
|MirroringPackageHeader||Contains FileSize, TargetFilePath, SizeOfSentData, SizeOfReceiveData.|
|MirroringStatus||Contains MirroringState and StatusLog (contains information about Processing, Warning and Error etc).|
There monitoring modes are Offline and Online.
- Offline Monitoring. The Mirroring Server by default logs all states of a mirroring job as an XML file under C:\MirroringMonitoringData\. The filename starts with a unique id and timestamp. In the CTP version this mode is always on, it cannot be configured. The XML file contains a list of MirroringStatusEventArgs.
- Online Monitoring. The Monitoring server sends events to subscribers online.
The Monitoring Server is based on Windows Communication Foundation (WCF) Duplex Communication channel and as with all WCF this can be configured in the config file. By default the Monitoring Server is tightly integrated with the Mirroring Server 2.0 and the installation program configures it by default to use port 80.
Monitoring server configuration
By default, the Mirroring installer takes care of the Monitoring Server configuration as shown below.
<service name="EPiServer.MirroringService.MirroringMonitoringService.MirroringMonitoringServer" behaviorConfiguration="DebugServiceBehaviour"> <endpoint address="~/SitePath/MirroringMonitoringServer.svc" name="" binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBinding_MirroringMonitoringBinding" contract="EPiServer.MirroringService.MirroringMonitoring.IMirroringMonitoringEventSystem" /> </service>
Monitoring client configuration
<client> <endpoint name="" address="~/SitePath/MirroringMonitoringServer.svc" binding="wsDualHttpBinding" contract="EPiServer.MirroringService.MirroringMonitoring.IMirroringMonitoringEventSystem" /> </client>
Using the monitoring utility
A custom subscriber can use the MirroringMonitoringClient helper class. The subscriber can receive events via the MirroringTransferStatusEventHandler. There is also possibility to subscribe on a specific mirroring job via the Subscribe (GUID contextId) method or for all mirroring jobs via the Subscribe() method.
Helper class code example
To make a subscription against the monitoring server, you need only to create an instance of MirroringMonitoringClient endpointName which is defined in app.config.
To receive Mirroring events or to be notified from the Monitoring Server, the application has to add a handler to the MirroringTransferStatusEventHandler event.
The Mirroring 2.0 ships with a simple example Monitoring WinForms application which the user can use to view both online and offline logs.