Slide 439
Slide 439 text
Copyright (C) 2011, David Beazley, http://www.dabeaz.com
6-
Creating Proxies
19
p = Process(target=somefunc)
• Create a utility function for it
from multiprocessing.connection import Client
def proxy(proxyname,target,address,authkey):
conn = Client(address,authkey=authkey)
pxy = ProxyTask(proxyname,target,conn)
pxy.start()
register(proxyname,pxy)
proxy("e","e",("localhost",15000),authkey=b"12345")
proxy("ext:f","f",("localhost",15000),authkey=b"12345")
# Send a message to a remote actor
send("e","hello world")
send("ext:f","hello world")
• Creates a connection using multiprocessing
and registers a proxy task to accept messages