org.mule.example.notifications
Class HeartbeatAgent

java.lang.Object
  extended by org.mule.AbstractAgent
      extended by org.mule.example.notifications.HeartbeatAgent
All Implemented Interfaces:
Agent, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, NameableObject, NamedObject

public class HeartbeatAgent
extends AbstractAgent

A simple agent that fire HeartbeatNotification events at a given frequency to notify that the server is alive and well.


Nested Class Summary
 class HeartbeatAgent.Heartbeat
           
 
Field Summary
static String NAME
           
 
Fields inherited from class org.mule.AbstractAgent
muleContext, name
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
HeartbeatAgent()
           
 
Method Summary
 void dispose()
          A lifecycle method where implementor should free up any resources.
 long getFrequency()
           
 void initialise()
          Method used to perform any initialisation work.
 void setFrequency(long frequency)
           
 void start()
           
 void stop()
           
 
Methods inherited from class org.mule.AbstractAgent
getDescription, getName, setMuleContext, setName, unregisterMeQuietly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values
Constructor Detail

HeartbeatAgent

public HeartbeatAgent()
Method Detail

getFrequency

public long getFrequency()

setFrequency

public void setFrequency(long frequency)

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

start

public void start()
           throws MuleException
Throws:
MuleException

stop

public void stop()
          throws MuleException
Throws:
MuleException

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.



Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.