Esempio n. 1
0
class _DispatcherREPConnection(ZmqREPConnection):
    def __init__(self, zf, e, core):
        ZmqREPConnection.__init__(self, zf, e)
        self.dispatcher = CommandDispatcher(core)

    def gotMessage(self, msgId, *parts):

        r = self.dispatcher.dispatch(parts)
        r.addCallback(self.defer_reply, msgId)

    def defer_reply(self, response, msgId):
        reactor.callLater(0, self.reply, msgId, str(response))

    def log_err(self, failure, msgId):
        log.err(failure)
        self.defer_reply("ERROR: %r" % failure, msgId)

    def do_greet(self):
        log.msg("starting ZMQ dispatcher")
Esempio n. 2
0
 def __init__(self, zf, e, core):
     ZmqREPConnection.__init__(self, zf, e)
     self.dispatcher = CommandDispatcher(core)