[zeromq-dev] python-zeromq can't work with fork?
张沈鹏
zsp007 at gmail.com
Tue May 19 04:56:09 CEST 2009
I send message like below
-----------------------------------
from const import *
from decorator import decorator
import marshal
from zconf.app.config import ZMQ_SERVER
import sys
def async_rpc(type):
def _async_call(func):
import libpyzmq
zmq = libpyzmq.Zmq (host = ZMQ_SERVER)
eid = zmq.create_exchange (
name = 'zmq_rpc_client',
scope = libpyzmq.SCOPE_LOCAL
#,
# style = libpyzmq.STYLE_LOAD_BALANCING
)
zmq.bind ('zmq_rpc_client', 'zmq_rpc_server')
TYPE2FUNC[type]=func
def _func(func, *args, **kwds):
para = marshal.dumps((args,kwds))
msg = "%s%s"%(type,para)
print ">>>",func
sys.stdout.flush()
zmq.send(eid,msg,True)
return decorator(_func, func)
return _async_call
Then , in my web app , if I use WSGIServer , everything seems right
-----------------------------------
from flup.server.fcgi import WSGIServer
WSGIServer(
init_zapp.zapp,
bindAddress=('127.0.0.1', 10528)
).run()
-----------------------------------
But when i use fcgi_fork, the server can't receive the message
from flup.server.fcgi_fork import WSGIServer
WSGIServer(
init_zapp.zapp,
bindAddress=('127.0.0.1', 10527)
).run()
----------------------
More information about the zeromq-dev
mailing list