I am implementing a poller service whose interface looks like this.
poller = Poller.new(SomeClass)
poller.start
poller.stop
The start
method is supposed to continuously start hitting an http request and update stuff in the database. Once start
ed, the process is supposed to continue till it is explicitly stop
ed.
I understand that implementation of start
needs to spawn and run in a new process. I am not quite sure how to achieve that in Ruby. I want a ruby solution instead of a ruby framework specific solution (Not rails plugins or sinatra extensions. Just ruby gems). I am exploring eventmachine and starling-workling. I find eventmachine to be too huge to understand in short span and workling is a plugin and not a gem. So it is a pain get it working for Ruby application.
I need guidance on how do I achieve this. Any pointers? Code samples will help.
Edit
Eventmachine or starling-workling solution would be preferred over threading/forking.