Queueing in Python (ala JMS)

Tim Williams (gmail) tdwdotnet at gmail.com
Tue Dec 20 09:12:01 EST 2005


On 20 Dec 2005 15:01:02 +0100, Stefan Arentz <stefan.arentz at gmail.com>
wrote:
>
>
> Is there a JMS-like API available for Python? I would like to
> quickly receive messages through the network and then process
> those slowly in the backgound. In the Java world I would simply
> create a (persistent) queue and tell the JSM provider to run
> N messagehandlers parallel.
>
> Is something like that available for Python?



The Queue module

import Queue
q = Queue.Queue

and  pass q as an argument to each "worker" ,

Then use ,

q.put()
q.get()  # or q.get(1)  if you need to wait for something to appear

HTH :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051220/2e29214a/attachment.html>


More information about the Python-list mailing list