Permalink
Browse files

ZSubscriber working

  • Loading branch information...
1 parent 225041f commit 140dce7302dcbcfef2183967884dedb069052e07 @amitu committed Jan 6, 2011
Showing with 3 additions and 3 deletions.
  1. +0 −1 dutils/zconfig.py
  2. +3 −2 dutils/zutils.py
View
@@ -76,7 +76,6 @@ def thread_quit(self):
def get(key, default=NOT_SET):
data = query("read:%s" % key, raw_output=True)
- print data
if data == "NA" and default != NOT_SET:
query("write:%s:%s" % (key, default))
data = default
View
@@ -35,7 +35,6 @@ def shutdown(self): self.publish("ZPublisher.Shutdown")
def run(self):
self.socket = CONTEXT.socket(zmq.PUB)
self.socket.bind(self.bind)
- print "ZPublisher listening on", self.bind
while True:
msg = self.q.get()
if msg == "ZPublisher.Shutdown":
@@ -46,17 +45,19 @@ def run(self):
# ZSubscriber # {{{
class ZSubscriber(threading.Thread):
- def __init__(self, bind):
+ def __init__(self, bind, glob=""):
super(ZSubscriber, self).__init__()
self.daemon = True
self.bind = bind
+ self.glob = glob
self.start()
def process(self, msg): pass
def run(self):
self.socket = CONTEXT.socket(zmq.SUB)
self.socket.connect(self.bind)
+ self.socket.setsockopt(zmq.SUBSCRIBE, self.glob)
while True:
self.process(self.socket.recv())
# }}}

0 comments on commit 140dce7

Please sign in to comment.