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 Type Method Description booleanaddHandler(MessageHandler handler)Add a message handler.booleandispatch(Message<?> message)Dispatch the message.intgetHandlerCount()Return the current handler count.booleanremoveHandler(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.
-