DataSource.NET  7.1.12.29475-aead280
Caplin.DataSource.IConnectionListener Interface Reference

This interface allows applications to receive events about the state of DataSource.NET's connection to other DataSource peers. More...

Inherited by Caplin.DataSource.Publisher.PublisherBase.

Public Member Functions

void PeerStatus (IPeerStatusEvent ev)
 Invoked when a DataSource peer changes state. More...
 
void ServiceStatus (IServiceStatusEvent ev)
 Invoked when a DataService changes state. More...
 

Detailed Description

This interface allows applications to receive events about the state of DataSource.NET's connection to other DataSource peers.

Should you wish to receive this information in your DataSource, then you must define a class that implements this interface and register it with DataSource.NET using the AddConnectionListener() method.

Once registered, the implementation will be informed of all changes to peer and DataService status.

The IConnectionListener methods are not called on a dedicated worker thread. Therefore, if any of these methods are likely take a relatively long time to execute, they should be coded to run in a separate thread.

The following class is an example implementation of IConnectionListener that logs connection status change events to the logger.

using System;
using System.Diagnostics;
namespace DataSourceExamples.ConnectionListener
{
public class ExampleConnectionListener : IConnectionListener
{
private ILogger logger;
public ExampleConnectionListener(ILogger logger)
{
this.logger = logger;
}
#region IConnectionListener Members
public void ServiceStatus(IServiceStatusEvent ev)
{
logger.Log(LogLevels.Notify, "Example", string.Format("Service status updated: {0} {1}", ev.ServiceName, ev.Status));
}
public void PeerStatus(IPeerStatusEvent ev)
{
logger.Log(LogLevels.Notify, "Example", string.Format("Peer status updated: {0} {1}", ev.Peer.Name, ev.Status));
}
#endregion
}
}

Member Function Documentation

void Caplin.DataSource.IConnectionListener.PeerStatus ( IPeerStatusEvent  ev)

Invoked when a DataSource peer changes state.

Parameters
evAn event containing information about the change in the peer's state.
void Caplin.DataSource.IConnectionListener.ServiceStatus ( IServiceStatusEvent  ev)

Invoked when a DataService changes state.

Parameters
evAn event containing information about the change in state of the data service.

Generated on Fri Feb 14 2020 17:46:10 for DataSource.NET