DataSource.NET
Caplin.DataSource.Monitoring Namespace
NamespacesCaplin.DataSource.Monitoring
The monitoring system within DataSource.NET allows your application to publish attributes and expose operations that can be invoked by any JMX application.
Declaration Syntax
C#Visual BasicVisual C++
namespace Caplin.DataSource.Monitoring
Namespace Caplin.DataSource.Monitoring
namespace Caplin.DataSource.Monitoring
Types
All TypesClasses
IconTypeDescription
MonitorableValue
Attribute that should be applied to methods and properties that are visible to the monitoring subsystem.

MonitoringBean
Base type for all monitoring beans. You should extend this class to add in your own monitoring attributes and/or methods.

Remarks

DataSource.NET is built using Caplin's DSDK which is a C library that can optionally embed a JVM to permit access from JMX clients to attributes and operations exposed by the library. All of the built-in monitoring within DSDK is also exposed by DataSource.NET.

The Monitoring namespace allows your application to add instrumentation to the same JMX implementation and thus allow your application to be controlled by JMX clients such as the Caplin Management Console.

Examples
CopyC#
using System;
using System.Collections.Generic;
using System.Text;
using Caplin.DataSource.Monitoring;

namespace DataSourceExamples.Monitoring
{
    // Example of how to create attributes and operations for the monitoring system
    public class ExampleMonitoringBean : MonitoringBean
    {
        public ExampleMonitoringBean()
            : base("datasource.application.monitoring", "Example monitoring interface", "SINGLETON")
        {

        }

        // Example of a monitoring attribute that needs to be polled for changes
        [MonitorableValue("string-array", Description = "String array", Active = true)]
        public string[] Strings { get { return new string[] { "element1", "element1" }; } }

        // Similarly, a int array attribute that needs to be polled
        [MonitorableValue("int-array", Description = "Integer array", Active = true)]
        public int[] Ints { get { return new int[] { 1, 2, 3, 4 }; } }

        // A monitoring attribute that will generated notifications when changed
        private int updatesSent = 0;
        [MonitorableValue("updates-sent", Description = "Number of updates sent")]
        public int UpdatesSent
        {
            get { return updatesSent; }
            set { base.SetField(ref updatesSent, value, "updates-something"); }
        }

        // An operation
        [MonitorableValue("exec-something", Description = "Do something")]
        public string MyFunc(int val, string bar)
        {
            return "FF";
        }

    }
}