On Mon, Jul 12, 2010 at 06:35:53PM -0400, Rich Meyers wrote:
>
> 3. Ruote does not limit concurrency. If some of my workflows use external
> resources such as downloading files from the internet I don't want an
> unbounded number of these workflows running at once.
A quick note about that one. Maybe I answered a bit too fast yesterday.
~a~
Your question could be translated to "I have a participant that download files,
I don't want ruote to spawn a thread each time it hands a workitem to that
participant".
There is a ready answer, it's "use do_not_thread".
---8<---
class MyParticipant
def initialize (opts)
# ...
end
def consume (workitem)
# ...
end
def do_not_thread
true
end
end
--->8---
The problem with do_not_thread is that the whole worker will be waiting for the
workitem consumption to finish before doing anything else.
In the snippet above, do_not_thread always returns true, you could imagine
scenarii where it could return false based on some condition.
Probably not an adequate solution.
~b~
Another, more common solution, I've seen to the class of problem you seem to
have is to communicate with the "downloaders" via a queue (resque, beanstalk,
amqp-someting).
You could also imagine leaving the workitems in a Ruote::StorageParticipant and
letting the downloaders poll that inbox whenever they're free to download.
With those ~b~ solutions, you choose the number of downloaders to instantiate.
Best regards,
--
John Mettraux - http://jmettraux.wordpress.com
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en