title: Architecture of a queue based system
body: <p>I have a system made of 12 windows services, say A, B ... M. They only exchange information via a queue (MSMQ in this case). The system works in linear fashion - an external party calls A, which publishes a message on a queue that B consumes. The format of the output is fixed, say AResult. B reads AResult, does some processing and publishes BResult to service C, etc.</p>
  
  <p>The problem I'm running into now is that services down the pipeline need data not supplied by the previous step. E.g. service F needs properties from BResult.</p>
  
  <p>I've considered a few alternatives, but they all have shortcomings:</p>
  
  <ol>
  <li><p>Pass a dictionary of all previous results along. That way say F will
  be able to read AResult, BResult, etc. The problem is this will
  introduce high coupling, any change anywhere can break other
  services.</p></li>
  <li><p>Have a global God object that different services populate. I've done something similar before and it ended very complex.</p></li>
  <li><p>Maintain a special object of the most useful data and pass it along each result. E.g. D receives CResult and GlobalContextData and publishes DResult and GlobalContextData. The problem is deciding to include in the context and maintaining it.</p></li>
  </ol>