0

Event-driven is a nice concept. But business is not concerned with programming approaches, rather it expects application to be fast, robust, fault-tolerant, etc.

If I have the following process:

(ext. system) -> IData -> T1 -> T2 -> (ext. system)

I can bind T1 and T2 together, like that:

class T1 {
  void consume(IData data) {
    t2.consume(data);
  }
}

While in the event-driven approach I need a medium, a message:

class T1 {
  void accept(IData data) {
    sendOut(new DataMessage(data));
  }
}

So, eventually, another wrapper is created for every single piece of data. Which creates huge amount of garbage to be collected later.

Question: how to process big amount of data, without creating any wrappers at all?

Denis Kulagin
  • 8,472
  • 17
  • 60
  • 129
  • Probably no definitive right answer, but I would favour the former approach, with the condition that T1 and T2 are interfaces. That way, implementations can be substituted for different scenarios, e.g. test implementations, remote implementations for ESB etc. – NickJ Mar 12 '15 at 09:14
  • All the garbage will be in the young generation, and so this will not cause expensive compactions. – Raedwald Mar 12 '15 at 09:37

0 Answers0