Created
September 21, 2012 22:37
-
-
Save mwhooker/3764325 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mport logging | |
| import time | |
| import json | |
| from kazoo.client import KazooClient | |
| from jones.client import JonesClient | |
| log = logging.getLogger('kazoo') | |
| log.addHandler(logging.StreamHandler()) | |
| def listener(*args): | |
| print "listener: ", args | |
| ZK_HOSTS = ','.join('zk-%d.i.disqus.net:2181' % i for i in (1, 2, 3)) | |
| kc = KazooClient(ZK_HOSTS) | |
| kc.add_listener(listener) | |
| kc.start() | |
| jones = JonesClient(kc, 'da') | |
| while True: | |
| print json.dumps(dict(jones)) | |
| print kc.state | |
| print kc.command() | |
| time.sleep(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment