Package org.powertac.samplebroker.core
Class MessageDispatcher
java.lang.Object
org.powertac.samplebroker.core.MessageDispatcher
@Service public class MessageDispatcher extends Object
Routes incoming messages to broker components, and outgoing messages
to the server.
Components must register for specific message types with the broker,
which passes the registrations to this router. For this to work,
registered components must implement a handleMessage(msg) method that
takes the specified type as its single argument.
- Author:
- John Collins
-
Constructor Summary
Constructors Constructor Description MessageDispatcher()Default constructor -
Method Summary
Modifier and Type Method Description voidregisterMessageHandler(Object handler, Class<?> messageType)Sets up handlers for incoming messages by message type.voidrouteMessage(Object message)Routes incoming messages from the servervoidsendMessage(Object message)Converts outgoing message to XML, sends it to the servervoidsendRawMessage(String message)Sends XML-formatted message to the server without interpretation.
-
Constructor Details
-
MessageDispatcher
public MessageDispatcher()Default constructor
-
-
Method Details
-
registerMessageHandler
Sets up handlers for incoming messages by message type. -
routeMessage
Routes incoming messages from the server -
sendMessage
Converts outgoing message to XML, sends it to the server -
sendRawMessage
Sends XML-formatted message to the server without interpretation.
-