Posts

Showing posts from January, 2020

Reactor or Dispatcher pattern.

Image
What is the reactor design pattern? As the name suggests, it reacts to the client request. And dispatch the client's request to the right service. In more technical words, it demultiplex different requests to different services. It is one of the many ways to implement event-driven architecture. The reactor design pattern teaches us how to handle multiple clients synchronously. Different clients can ask for different services from the server — the reactor pattern decuple request handling and despatching to a particular service. The reactor maintains a lookup table, which is a kind of map which holds pointers to concrete event implementations. Though which we can call hooked methods when event occurs. The reactor pattern cannot scaleup much, because it does serialization at the demultiplexing layer. We can create one reactor or dispatcher for multiple events, or we can create multiple  reactors, one per event. In case of multiple reactors, each reactor has its synchronous...