From 1068ff9bf74cf411be701bb50fae92e8476b5da7 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sun, 20 Jan 2013 23:53:52 +0100 Subject: datastore foo --- datastore/dump.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 datastore/dump.py (limited to 'datastore/dump.py') 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() -- cgit v1.2.1