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 Summary
Modifier and TypeMethodDescriptionboolean
addHandler
(MessageHandler handler) Add a message handler.boolean
Dispatch the message.int
Return the current handler count.boolean
removeHandler
(MessageHandler handler) Remove a message handler.
-
Method Details
-
addHandler
Add a message handler.- Parameters:
handler
- the handler.- Returns:
- true if successfully added.
-
removeHandler
Remove a message handler.- Parameters:
handler
- the handler.- Returns:
- true of successfully removed.
-
dispatch
Dispatch the message.- Parameters:
message
- the message.- Returns:
- true if dispatched.
-
getHandlerCount
int getHandlerCount()Return the current handler count.- Returns:
- the handler count.
-