Results 1 to 1 of 1

Thread: Hearbeat and listeners class

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Hearbeat and listeners class

    A heartbeat is a periodic event that tells you that your application is running. In this example the heartbeat is implemented by a static "heartbeat" class which has a "beat" event that fires every second.

    The beat is passed on to any listeners that have been attached to the heartbeat. You can do this by adding listeners to the application configuration e.g.:-

    Code:
    <configSections>
      <section name ="heartbeatSettings" 
          type="Monitoring.HeartbeatCustomConfigSection, Monitoring, 
                Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"/>
    </configSections>
    <!-- ... -->
    <heartbeatSettings>
        <heartbeats>
          <clear />
          <add Name="HeartbeatTrace"  
                Type="Monitoring.TraceHeartbeatMonitor, Monitoring, 
                      Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" />
          <add Name="HeartbeatTraceTwo" 
                Type="Monitoring.TraceHeartbeatMonitor, Monitoring, 
                      Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"  
                InitData="foo" />
        </heartbeats>
    </heartbeatSettings>
    And then the only thing you need to do is to ask the heartbeat class to read its listeners collection from the configuration file by:-
    Code:
    Monitoring.Heartbeat.ResetListensersFromConfig();
    You can create your own listener - to send heartbeats over the network or have a beating icon in the tray or what ever by inheritting from HeartbeatListenerBase
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width