Handling composite events

Coordinator
Apr 4, 2012 at 3:02 PM

User submits a FooReq event on the facade. After dispatching Processor.1 starts working on it, but decides that it will require additional information, so it returns a BarReq event to Dispatcher. It routes the event to the relevant processor (.2), it responds with a Bar event. Now, an event that contains both the original FooReq and Bar data, should be routed to the first processor.

  • First approach may be that Dispatcher creates a new event when Bar is available, FooReqWithBar, populates it with data from both messages, and passes it to a relevant processor (a third one).
  • Second approach may be that Processor.1 does not returns with a BarReq event, but with a BarReqForFoo event, which extends BarReq event with Foo data. Processor.2 will handle this event, returning BarForFoo response, where Foo data may be present along with Bar result.
  • Third approach may be that each event has a property bag, which is populated with all the accumulated information. First, the bag will be empty, and later, Bar result will be in it.

This third one is what I currently have in my mind, but internal message handling protocol should be extended to handle this case.