@Service public class MessageDispatcher extends Object implements org.powertac.common.interfaces.VisualizerMessageListener, NewObjectListener
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.
| Constructor and Description |
|---|
MessageDispatcher() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
static Object |
dispatch(Object target,
String methodName,
Object... args)
Dispatches a call to methodName inside target based on the type of
message.
|
void |
handleNewObject(Object obj) |
void |
receiveMessage(Object message) |
void |
registerAllHandlers() |
@PostConstruct public void afterPropertiesSet() throws Exception
Exceptionpublic void receiveMessage(Object message)
receiveMessage in interface org.powertac.common.interfaces.VisualizerMessageListenerpublic void handleNewObject(Object obj)
handleNewObject in interface NewObjectListenerpublic static Object dispatch(Object target, String methodName, Object... args)
Note that this scheme finds only exact matches between types of arguments and declared types of formal parameters for declared or inherited methods. So it will not call a method with formal parameter types of (Transaction, List) if the actual arguments are (Transaction, ArrayList).
public void registerAllHandlers()
Copyright © 2019 Power TAC. All rights reserved.