Simple tornado stomp 1.1 client.
with pip:
pip install torstomp
# -*- coding: utf-8 -*-
from tornado import gen
from tornado.ioloop import IOLoop
from torstomp import TorStomp
@gen.coroutine
def main():
client = TorStomp('localhost', 61613, connect_headers={
'heart-beat': '1000,1000'
}, on_error=report_error)
client.subscribe('/queue/channel', callback=on_message)
yield client.connect()
client.send('/queue/channel', body=u'Thanks', headers={})
def on_message(frame, message):
print('on_message:', message)
def report_error(error):
print('report_error:', error)
if __name__ == '__main__':
main()
IOLoop.current().start()
With empty virtualenv for this project, run this command:
make setup
and run all tests =)
make test
Fork, patch, test, and send a pull request.