From 862282ce99760832d3e9e5b4b1171b861105e004 Mon Sep 17 00:00:00 2001 From: Ebus-at-dockstar Date: Mon, 25 Mar 2013 10:24:28 +0100 Subject: move old stuff away --- heap/datastore/dump.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 heap/datastore/dump.py (limited to 'heap/datastore/dump.py') diff --git a/heap/datastore/dump.py b/heap/datastore/dump.py new file mode 100644 index 0000000..ac7ec29 --- /dev/null +++ b/heap/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