3 Example of handlers spawned from backend.spawner 7 from ..port
import Port
8 from ..message
import Message
9 from .proto
import Flow
10 from .util
import objectify
11 from pyre.zactor
import ZActor
23 print (
"spawn dumper")
31 print(
"dumper sees EOT")
39 Generate flow messages 41 print (
"spawn genner")
48 print(
"genner sees EOT")
58 self.
ctx = zmq.Context()
62 Broker calls this to dispatch a BOT. 64 Broker waits for return so don't dally. 67 direction = fobj[
"direction"]
69 if direction ==
"inject":
70 return self.
spawn(dump_actor, bot)
71 elif direction ==
"extract":
72 return self.
spawn(gen_actor, bot)
75 def spawn(self, actor_func, bot):
79 Function must take a flow and the BOT. 81 port =
Port(
"handler", zmq.CLIENT,
'')
85 actor = ZActor(self.
ctx, actor_func, flow, bot)
def dump_actor(ctx, pipe, flow, bot, args)
def __init__(self, server_address)
def gen_actor(ctx, pipe, flow, bot, args)
def handshake(pipe, flow, bot)
def spawn(self, actor_func, bot)