diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2013-01-20 23:53:52 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2013-01-20 23:53:52 +0100 |
commit | 1068ff9bf74cf411be701bb50fae92e8476b5da7 (patch) | |
tree | 5f54b2cb37bace46a0508544ec5116468c8f584b /datastore/dump.py | |
parent | a40afda64c61089d6c108eea9cb3eac8aeaaa072 (diff) | |
download | ebus-alt-1068ff9bf74cf411be701bb50fae92e8476b5da7.tar.gz ebus-alt-1068ff9bf74cf411be701bb50fae92e8476b5da7.zip |
datastore foo
Diffstat (limited to 'datastore/dump.py')
-rw-r--r-- | datastore/dump.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/datastore/dump.py b/datastore/dump.py new file mode 100644 index 0000000..ac7ec29 --- /dev/null +++ b/datastore/dump.py @@ -0,0 +1,29 @@ +from time import sleep +from stompclient import PublishSubscribeClient +import config +from threading import Thread +from pprint import pprint + +client = PublishSubscribeClient(config.STOMP_HOST, config.STOMP_PORT) +listener = Thread(target=client.listen_forever, name='Frame-Receiver') +listener.start() +client.listening_event.wait() +r = client.connect(config.STOMP_LOGIN, config.STOMP_PASSCODE) +if not client.connection: + print r + exit(1) + + +def dump(x): + pprint(x.headers) + for line in x.body.split("\n"): + print "\t", + pprint(line) + +client.subscribe("/queue/queue-new", dump) + +try: + while True: + sleep(1) +except: + client.disconnect() |