[zeromq-dev] Using zeromq inside twisted matrix daemon

Brian Granger ellisonbg at gmail.com
Wed Jul 28 18:46:09 CEST 2010


Hi,

Twisted and 0MQ won't work together as you have done because both have their
own event loop and the two will collide.  It would be possible to create a
twisted reactor that has 0MQ support, but it will take some work.  Here is a
thread about this topic:

http://lists.zeromq.org/pipermail/zeromq-dev/2010-June/003810.html

As with most Twisted things, it is either all twisted or no twisted.  As a
side note, we do have a minimal event loop in pyzmq that is compatible with
Tornado:

http://github.com/zeromq/pyzmq/tree/master/zmq/eventloop/

Cheers,

Brian

On Wed, Jul 28, 2010 at 12:25 AM, Uung H.R Bhuwono <avenpace at gmail.com>wrote:

> Hi,
>
> I've been trying to make use zeromq on my twisted daemon script
> When zeromq send message to the queue, this work since send_pyobj()
> return True.
> But the subscriber never get the message from queue using recv_pyobj()
> and it just freeze like there's nothing on the queue
>
> My twisted daemon script as a follow:
>
> - serve_message.py
> class MyService(service.Service):
>    def __init__(self):
>        pass
>    def startService(self):
>        c = zmq.Context(1)
>        s = c.socket(zmq.PUB)
>        s.bind("tcp://127.0.0.1:6666")
>        s.send_pyobj("helo there")
>    def stopService(self):
>        pass
>
> def getMyService():
>    myService = MyService()
>    return myService
>
> application = service.Application("My Service Application")
>
> # attach the service to its parent application
> procd = getMyService()
> procd.setServiceParent(application)
>
> my simple subscriber script subscriber.py
>
> import zmq
> c = zmq.Context(1)
> s = c.socket(zmq.SUB)
> s.connect("tcp://127.0.0.1:6666")
> s.setsockopt(zmq.SUBSCRIBE, "")
> s.recv_pyobj()
>
> I assume that twisted daemon messed up the zeromq messages queue
> Does it possible to use zeromq with twisted daemon on Linux?
> Does anyone has succeed before using zeromq with twisted daemon?
>
>
> Thanks,
>
> Uung
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100728/21b5958e/attachment.htm>


More information about the zeromq-dev mailing list