My requirement: A worker pool that basically renders templates to
html/pdf and sends emails.
The messages to process are currently stored in an OpenMQ queue
(accessible via stomp for ruby).
I am wondering whats the best way to create this worker pool. Initially
I thought about using resque, as most worker “frameworks” come with
their own queue… however a few concerns:
does putting msgs from one into another queue make sense?
how reliable is resque? I cannot lose mails
how to handle confirmation on the OpenMQ? if I insert the msgs into
resque
So I wondered how you would do this…
Maybe just create a lightweight pool of workers? How? I only found
existing ones having a queue… which is not really needed in this
scenario as I confirm messages on the OpenMQ…
I would appreciate any suggestions!
Thanks, Christoph
On Mon, Jan 24, 2011 at 8:16 PM, Christoph B. [email protected]
wrote:
their own queue… however a few concerns:
I would appreciate any suggestions!
I don’t know stomp and I have only rudimentary knowledge
of OpenMQ,
It seems the simplest solution would be to create a number of Ruby
processes that each individually fetch data from your OpenMQ one after
another and process it. You could add a controlling master process
that restarts child processes if they die. Sample:
Here is an example that will spawn 7 worker process and connect to a
beanstalkd job queue. Replace beanstalkd with an OpenMQ connection if
you want. However beanstalkd is very simple, reliable, requeues jobs if
they fail, etc.