Reactor Pattern In Ruby
04-Dec-2018 3422
Reactor pattern is an event handling pattern for operating service requests delivered concurrently to a service handler by one or more inputs. All the ready-to-use ruby implementations (like EventMachine and family,) although are very smart built and quite helpful, hide all the details. I decided to write down a short example of how the task may be accomplished in pure ruby.Let’s say we are interested in running an echo-service-like application. We don’t need any servers, just pure “wait-for-input → reply” app. The CLI wrapper might be a good example. All we want is to have a running instance somewhere that will accept internal calls like @inst.cmd("ls") and reply with a result of the command run.
Reactor Pattern In Ruby #ruby #rubydeveloper #rubyonrails #Reactor #Pattern #reactor https://rubyonrails.ba/link/reactor-pattern-in-ruby