akka.event

EventHandler

object EventHandler extends ListenerManagement

Event handler.

Create, add and remove a listener:

val eventHandlerListener = Actor.actorOf(new Actor {
  self.dispatcher = EventHandler.EventHandlerDispatcher

  def receive = {
    case EventHandler.Error(cause, instance, message) => ...
    case EventHandler.Warning(instance, message)      => ...
    case EventHandler.Info(instance, message)         => ...
    case EventHandler.Debug(instance, message)        => ...
    case genericEvent                                 => ...
  }
})

EventHandler.addListener(eventHandlerListener)
...
EventHandler.removeListener(eventHandlerListener)

However best is probably to register the listener in the 'akka.conf' configuration file.

Log an error event:

EventHandler.notify(EventHandler.Error(exception, this, message))
Or use the direct methods (better performance):
EventHandler.error(exception, this, message)

Shut down the EventHandler:

EventHandler.shutdown()

Linear Supertypes
ListenerManagement, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. EventHandler
  2. ListenerManagement
  3. AnyRef
  4. Any
Visibility
  1. Public
  2. All

Type Members

  1. case class Debug (instance: AnyRef, message: Any) extends Event with Product with Serializable

  2. class DefaultListener extends Actor

  3. case class Error (cause: Throwable, instance: AnyRef, message: Any) extends Event with Product with Serializable

  4. trait Event extends AnyRef

    Attributes
    sealed
  5. class EventHandlerException extends AkkaException

  6. case class Info (instance: AnyRef, message: Any) extends Event with Product with Serializable

  7. case class Warning (instance: AnyRef, message: Any) extends Event with Product with Serializable

Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. val DebugLevel : Int

  7. val ErrorLevel : Int

  8. lazy val EventHandlerDispatcher : MessageDispatcher

  9. val ID : String

  10. val InfoLevel : Int

  11. val WarningLevel : Int

  12. def addListener (listener: ActorRef): Unit

    Adds the listener this this registry's listener list.

    Adds the listener this this registry's listener list. The listener is started by this method if manageLifeCycleOfListeners yields true.

    Definition Classes
    ListenerManagement
  13. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  14. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  15. def debug (instance: AnyRef, message: Any): Unit

  16. def debug (instance: AnyRef, message: ⇒ String): Unit

  17. val debug : String

  18. val defaultListeners : Seq[String]

  19. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  20. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  21. def error (instance: AnyRef, message: Any): Unit

  22. def error (instance: AnyRef, message: ⇒ String): Unit

  23. def error (cause: Throwable, instance: AnyRef, message: Any): Unit

  24. def error (cause: Throwable, instance: AnyRef, message: ⇒ String): Unit

  25. val error : String

  26. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  27. def foreachListener (f: (ActorRef) ⇒ Unit): Unit

    Execute f with each listener as argument.

    Execute f with each listener as argument. ActorInitializationException is not handled.

    Attributes
    protected[akka]
    Definition Classes
    ListenerManagement
  28. def formattedTimestamp : String

  29. val generic : String

  30. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  31. def hasListener (listener: ActorRef): Boolean

    Checks if a specific listener is registered.

    Checks if a specific listener is registered. ActorInitializationException leads to removal of listener if that one isShutdown.

    Definition Classes
    ListenerManagement
  32. def hasListeners : Boolean

    Definition Classes
    ListenerManagement
  33. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  34. def info (instance: AnyRef, message: Any): Unit

  35. def info (instance: AnyRef, message: ⇒ String): Unit

  36. val info : String

  37. def isDebugEnabled : Boolean

  38. def isInfoEnabled : Boolean

  39. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  40. var level : Int

  41. def manageLifeCycleOfListeners : Boolean

    Specifies whether listeners should be started when added and stopped when removed or not

    Specifies whether listeners should be started when added and stopped when removed or not

    Attributes
    protected
    Definition Classes
    ListenerManagement
  42. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  43. def notify [T <: Event] (event: ⇒ T)(implicit arg0: ClassManifest[T]): Unit

  44. def notify (event: Any): Unit

  45. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  46. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  47. def notifyListeners (message: ⇒ Any): Unit

    Attributes
    protected[akka]
    Definition Classes
    ListenerManagement
  48. def removeListener (listener: ActorRef): Unit

    Removes the listener this this registry's listener list.

    Removes the listener this this registry's listener list. The listener is stopped by this method if manageLifeCycleOfListeners yields true.

    Definition Classes
    ListenerManagement
  49. def shutdown (): Unit

    Shuts down all event handler listeners including the event handle dispatcher.

  50. def stackTraceFor (e: Throwable): String

  51. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  52. def toString (): String

    Definition Classes
    AnyRef → Any
  53. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  54. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  55. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  56. def warning (instance: AnyRef, message: Any): Unit

  57. def warning (instance: AnyRef, message: ⇒ String): Unit

  58. val warning : String

Inherited from ListenerManagement

Inherited from AnyRef

Inherited from Any