On Jan 25, 2011, at 3:11 AM, Robert Klemme wrote:

> On Mon, Jan 24, 2011 at 8:16 PM, Christoph B. <ch.blank / gmail.com> =
wrote:
>> Hey,
>>=20
>> My requirement: A worker pool that basically renders templates to
>> html/pdf and sends emails.
>>=20
>> The messages to process are currently stored in an OpenMQ queue
>> (accessible via stomp for ruby).
>>=20
>> 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:
>>=20
>> - 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
>>=20
>> 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..
>>=20
>> I would appreciate any suggestions!
>=20
> <disclaimer>I don't know stomp and I have only rudimentary knowledge
> of OpenMQ,</disclaimer>
>=20
> 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:
>=20
> https://gist.github.com/794746
>=20

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.

https://github.com/TwP/servolux/blob/master/examples/beanstalk.rb

http://kr.github.com/beanstalkd/

Blessings,
TwP