On the Elegant Code Cast, I was asked what the difference was between a message and an event, and I really wasn’t happy with my answer. Well as luck would have it I recently started reading ‘The Power of Events’ in which the author gives a very good explanation (Below is a brief summation).
A message is just a structure. This structure could be as simple as the string ‘BUY’ or ‘SELL’ or it could be a complex structure like an object graph serialized to JSON. This is the message.
An event adds the components of ‘significance’ and ‘relativity’. Significance in this case is that the ‘message’ signifies some activity. The event’s form (again the message part) should contain data describing the event it signifies. Relativity is that it is related to other activities by time, causality and aggregation. Ok, so that introduces some other concepts. Time is easy, it happened on 12/31/2008. Causality is asking what caused this message. In MassTransit (MT), I am thinking of implementing this by placing the name of the message that is currently active in the message headers if you published any messages. Lastly, we have aggregation, if event A signifies the activity of the set of events B1, B2, B3… then A is an aggregation of the events Bi.
I look forward to finding ways to apply the thoughts and patterns in the book to MT in the near future. As for now though, 0.6 has hit RC status, and we are looking for feedback. So please pull the code down and run the samples. Let me know what you find and/or think.