def main(): import optparse parser = optparse.OptionParser('usage: %prog') ZmqPublisher.addOptions(parser, 'testPublishAttachments') opts, args = parser.parse_args() if args: parser.error('expected no args') logging.basicConfig(level=logging.DEBUG) # set up networking p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) p.start() # start publishing an arbitrary message that central should forward pubTimer = ioloop.PeriodicCallback(lambda: pubMessage(p), 1000) pubTimer.start() zmqLoop()
def __init__(self, logPath, opts): self.logPath = logPath self.opts = opts self.publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) print 'topics:', self.opts.topic