summaryrefslogtreecommitdiff
path: root/datastore/dump.py
blob: ac7ec29ee1acc38cbbfc8fd97ca5702e6583269f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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()