DataSource.NET  6.2.20.310828
Caplin.DataSource.Monitoring.NamespaceDoc Class Reference

The monitoring system within DataSource.NET allows your application to publish attributes and expose operations that can be invoked by any JMX application. More...

Detailed Description

The monitoring system within DataSource.NET allows your application to publish attributes and expose operations that can be invoked by any JMX application.

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.

using System;
using System.Collections.Generic;
using System.Text;
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";
}
}
}

Generated on Wed Jan 24 2018 12:22:40 for DataSource.NET