Database Reference
In-Depth Information
Introducing custom checks
With ServiceControl.Plugin.CustomChecks installed, we can perform several checks.
In this section, we will be using the
PubSub--ReportFailure
solution—the
MyPublisher
project reports a failure check that will be reported in ServicePulse. This solution shows
custom checks.
In this section, we will also be using the
PubSub--ReportPass
solution—the
MyPublisher
project reports a pass check that will be reported in ServicePulse. This solution shows cus-
tom checks.
There are the following base constructors under the
CustomCheck
package—the base
constructor is used to define which class is passing or failing:
•
ReportPass
: This will report that the custom check has passed
•
ReportFailed
: This will report that a custom check has failed, passing in the
string stating the reason for the failure
Here, we create the code for a custom check object that can be called when we submit a
payment as an additional check. It is a simple constructor in a
MyCustomCheck
class that
will pass information through the base class of
CustomCheck
. We call this class when we
send the
SubmitPayment
command from the
ECommerce
project using
MyCus-
tomCheck myCheck = new MyCustomCheck();
:
using System;
using System.IO;
using ServiceControl.Plugin.CustomChecks;
using ServiceControl.Plugin.CustomChecks.Messages;
using ServiceControl.Plugin.CustomChecks.Internal;
namespace PaymentEngine.ECommerce
{
public class MyCustomCheck : CustomCheck
{
public MyCustomCheck()
: base("ECommerce SubmitPayment check",
"ECommerce")
{
ReportPass();