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 Details

  • Method Details

    • registerMessageHandler

      public void registerMessageHandler​(Object handler, Class<?> messageType)
      Sets up handlers for incoming messages by message type.
    • routeMessage

      public void routeMessage​(Object message)
      Routes incoming messages from the server
    • sendMessage

      public void sendMessage​(Object message)
      Converts outgoing message to XML, sends it to the server
    • sendRawMessage

      public void sendRawMessage​(String message)
      Sends XML-formatted message to the server without interpretation.