Stomping with Python and ActiveMQ (Stomp Framework)
python-stomping is a simple Stomp framework I wrote which makes creating stomp services in Python easy.
Install requirements
$ sudo yum install python-twisted python-stomperCheckout stomping
$ svn export http://silassewell.googlecode.com/svn/trunk/projects/python-stomping python-stomping $ cd python-stompingUpdate the
example.pyfile to use yourhost,port,usernameandpasswordActiveMQ/Stomp broker settingsfrom stomping import Stomping, route class MyStomping(Stomping): def init(self): self.send('/queue/test1', 'init test1') self.send('/queue/test2', 'init test2') @route('/queue/test1') def a_test(self, message): print 'a_test: %s' % message['body'] @route('/queue/test1') @route('/queue/test2') def b_test(self, message): print 'b_test: %s' % message['body'] if __name__ == '__main__': stomp = MyStomping(host='127.0.0.1', port=61613, username='guest', password='guest') stomp.run()Run
example.py(Ctrl+c to quit)$ python example.py a_test: init test1 b_test: init test1 b_test: init test2
NOTE: python-stomping is just a light wrapper around Twisted and stomper and is based on an example provided in the stomper code.