Interface MessageDispatcher

All Known Implementing Classes:
AbstractDispatcher, BroadcastingDispatcher, UnicastingDispatcher

public interface MessageDispatcher
Strategy interface for dispatching messages to handlers.
Author:
Mark Fisher, Gary Russell
  • Method Details

    • addHandler

      boolean addHandler​(MessageHandler handler)
      Add a message handler.
      Parameters:
      handler - the handler.
      Returns:
      true if successfully added.
    • removeHandler

      boolean removeHandler​(MessageHandler handler)
      Remove a message handler.
      Parameters:
      handler - the handler.
      Returns:
      true of successfully removed.
    • dispatch

      boolean dispatch​(Message<?> message)
      Dispatch the message.
      Parameters:
      message - the message.
      Returns:
      true if dispatched.
    • getHandlerCount

      int getHandlerCount()
      Return the current handler count.
      Returns:
      the handler count.