Skip to main content

InterDyne Messages

InterDyne has a very rich messaging system that supports a wide range of messages from the very simple (for which examples are given below) to the very complex (for example, detailed FIX messages between components of a financial system).  The messaging system is of central importance to InterDyne since messages are the medium for interaction between components.

Messages are all of type Msg_t and are either (i) one-to-one messages, or (ii) broadcast messages.   All messages include a pair of integers that indicate (i) the IDs of the sending and receiving agents for one-to-one messages, or (ii) the sending agent ID and the receiving broadcast channel ID for broadcast messages.  Examples include:

  • Message (Int, Int) [Arg_t] - a one-to-one message, sending a list of (key, value) pairs
  • Ordermessage (Int, Int) Order - a one-to-one message, sending an order (typically to a component that models an exchange)
  • Datamessage (Int,Int) [Char] - a one-to-one message sending a string
  • Debugmessage (Int, Int) [Char] - a one-to-one message sending a string (for debugging purposes)
  • Broadcastmessage (Int, Int) Broadcast_t - a broadcast message sent to a broadcast channel and containing data whose type is further defined within Broadcast_t

If a message is sent to agent ID 0 it receives special treatment.  Agent ID 0 is reserved for the simulator harness, and a message sent to ID 0 is printed to an output file.  This is the primary mechanism for defining the output of the simulator.  Currently the main output file is the "trace file" that records all messages sent to ID 0 except for those with constructor Datamessage - these messages are instead output to a special file "data.csv", and this provides  mechanism for structured output that can be viewed as a spreadsheet. 

Here is a simple agent wrapper that sends a debug message to the output trace file (via the simulator harness) at every time step.  It does not call a logic function:

f :: Agent_t
f st args ((t, msgs, bcasts) : rest) myid
     =  [m]  : (f st args rest myid)
        m = Debugmessage (myid,0) ("Debug "++(show t))