Queue Worker

74 views
Skip to first unread message

ben

unread,
Jun 20, 2011, 4:54:56 PM6/20/11
to HotQueue Users
I'm using the Queue Worker example from the documentation. I want to
push a json strings to two or more workers but when I copy the same
worker code into antother .py file and execute both workers the pushed
info only shows up in one worker. Can I change this?

richardhenry

unread,
Jun 20, 2011, 6:26:33 PM6/20/11
to HotQueue Users
Hey Ben,

Items from the queue are distributed to workers one-by-one, and are
not duplicated across workers. If you push 1,000 items onto a queue
with 2 workers, you'll notice that roughly 500 of them go to one
worker, and 500 of them go to the other (assuming that each job takes
approximately the same amount of time).

It sounds like you're not really looking for a FIFO queue here, and
you should check out the Pub/Sub functionality in Redis instead; this
should allow you to send a message to multiple listeners (which is
what it sounds like you're trying to do). Here's the documentation:
http://redis.io/commands#pubsub

If you're looking to do this in Python, you can take advantage of that
feature using redis-py.

Let me know if this helps!

Richard

ben

unread,
Jun 23, 2011, 1:52:27 PM6/23/11
to HotQueue Users
Hey Richard,

thank you! That's what I was searching for.
I'm trying to put a tornado websocket server together which sends the
redis channel subscribtion to the browser.
One step closer now ;) I have to mention that I liked your extensive
documentation of hotqueue though.

Cheers
Ben
Reply all
Reply to author
Forward
0 new messages