|
Project Information
Members
Featured
Downloads
Links
|
StomperAuthor: Oisin Mulvihill IntroductionThis is a python client implementation of the STOMP protocol. The client is attempting to be transport layer neutral. This module provides functions to create and parse STOMP messages in a programatic fashion. The messages can be easily generated and parsed, however its up to the user to do the sending and receiving. The STOMP protocol specification can be found here: http://stomp.codehaus.org/Protocol/ I've looked at the stomp client by Jason R. Briggs. I've based some of the 'function to message' generation on how his client does it. The client can be found at the follow address however it isn't a dependancy. http://www.briggs.net.nz/log/projects/stomppy I now test using the basic MorbidQ broker http://www.morbidq.com/ which is easy-installable "easy_install morbid". MorbidQ uses stomper as a dependancy so it will be automatically downloaded and installed with MorbidQ. You can still use alternative brokers such as ActiveMQ. The server runs in java, however its fairly standalone and easy to set up. The projects page is here http://activemq.apache.org/ stomper is also available on PyPi: http://pypi.python.org/pypi/stomper ExamplesBasic UsageTo see some basic code usage example see "example/stomper_usage.py". The unit test "tests/teststomper.py" illustrates how to use all aspects of the code. Receive/SenderThe example "receiver.py" and "sender.py" show how messages and generated and then transmitted using the twisted framework. Other frameworks could be used instead. The examples also demonstrate the state machine I used to determine a response to received messages. I've also included "stompbuffer-rx.py" and "stompbuffer-tx.py" as examples of using the new stompbuffer module contributed by Ricky Iacovou. Version History"future release": I'm going to work on python 3 support for stomper and will release this as "stomper 0.3.0". I'm also going to move all documentation over to sphinx, which I now use a lot on other projects. 0.2.4OM: A minor relase fixing the problem whereby uuid would be installed on python2.5+. It is not needed after python2.4 as it comes with python. Arfrever Frehtes Taifersar Arahesis contributed the fix for this. 0.2.3OM: I've fixed issue #9 with the example code. All messages are sent and received correctly. 0.2.2
http://stomp.codehaus.org/Protocol gives the example: CONNECT login: <username> passcode:<passcode> ^@ and comments, "the body is empty in this case". This gives the impression that the body is *exactly* defined as "the bytes, if any, between the '\n\n' at the end of the header and the null byte". This works for both binary and ASCII payloads: if I want to send a string without a newline, I should be able to, in which case the body should look like: this is a string without a newline^@ ... and the receiver should deal with this. This impression is reinforced by the fact that ActiveMQ will complain if you supply a content-length header with any other byte count than that described above. I am also unsure about the newline after the null byte as nothing in the protocol says that there should be a newline after the null byte. Much of the code in StompBuffer actively expects it to be there, but I suspect that *relying* on a frame ending '\x00\n' may well limit compatibility. It's not an issue with Stomper-to-Stomper communication, of course, as the sender puts it, the receiver accepts it, and ActiveMQ happily sends it along.
|