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 boolean
addHandler(MessageHandler handler)
Add a message handler.boolean
dispatch(Message<?> message)
Dispatch the message.int
getHandlerCount()
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.
-