summaryrefslogtreecommitdiff
path: root/datastore/dump.py
diff options
context:
space:
mode:
Diffstat (limited to 'datastore/dump.py')
-rw-r--r--datastore/dump.py29
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()