Skip to main content

This is a transport neutral client implementation of the STOMP protocol.

Project description

=======
Stomper
=======

.. content:

:Author:
Oisin Mulvihill

Contributors:
Micheal Twomey, Ricky Iacovou <iacovou at gmail dot com>,
Arfrever Frehtes Taifersar Arahesis <arfrever dot fta at gmail dot com>


Introduction
------------

This 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:

- `Stomp Protocol <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.

- `stompy <http://www.briggs.net.nz/log/projects/stomppy>`_

In testing this library I run against ActiveMQ project. The server runs
in java, however its fairly standalone and easy to set up. The projects
page is here:

- `ActiveMQ <http://activemq.apache.org/>`_


Source Code
-----------

The code can be accessed via subversion via google project hosting. Further
details can be found here:

- `Stomper http://code.google.com/p/stomper/`_


Examples
--------

Basic Usage
~~~~~~~~~~~

To 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/Sender
~~~~~~~~~~~~~~

The 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
---------------

0.2.4
~~~~~

OM: 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.3
~~~~~

OM: I've fixed issue #9 with the example code. All messages are sent and received correctly.


0.2.2
~~~~~

- Applied patch from esteve.fernandez to resolve "Issue 4: First Message not received" in the
example code (http://code.google.com/p/stomper/issues/detail?id=4&can=1).

- I've (Oisin) updated the examples to use twisted's line receiver and got it to "detect"
complete stomp messages. The old example would not work if a large amount of data was streamed.
In this case dataReceived would be called with all the chunks of a message. This means that it
would not be correct for it to attempt to unpack and react until the whole message has been
received. Using twisted's line receiver looking for the \x00 works like a charm for this.


This release integrates the bug fixes and the optional stompbuffer contributed by Ricky
Iacovou:

- Removed the trailing '\n\n' inserted by Frame.pack(). I believe that adding this is
incorrect, for the following reasons:

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.

- StompBuffer has had a few fixes; most notably, a fix that prevents a content-length "header"
in the *body* from being picked up and used (!). The biggest change is a new method,
syncBuffer(), which allows a corrupted buffer to recover from the corruption. Note that
I've never actually *seen* the buffer corruption when using Twisted, but the thought
occurred to me that a single corrupt buffer could hang the entire message handling process.

- Fixed the typo "NO_REPONSE_NEEDED". I've changed it to NO_RESPONSE_NEEDED, but kept the
old variable for backwards compatibility;

- I've also modified the string format in send() to include the '\n\n' between the header
and the body, which I think is missing (it currently has only one '\n').

- Added CONNECTED to VALID_COMMANDS so syncBuffer() does not decide these messages are bogus.

- Added new unit test file teststompbuffer which covers the new functionality.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stomper-0.2.2.tar.gz (19.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

stomper-0.2.2.linux-i686.tar.gz (37.4 kB view details)

Uploaded Source

stomper-0.2.2-py2.6.egg (53.8 kB view details)

Uploaded Egg

stomper-0.2.2-py2.5.egg (53.4 kB view details)

Uploaded Egg

stomper-0.2.2-py2.4.egg (53.9 kB view details)

Uploaded Egg

File details

Details for the file stomper-0.2.2.tar.gz.

File metadata

  • Download URL: stomper-0.2.2.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for stomper-0.2.2.tar.gz
Algorithm Hash digest
SHA256 1505bf64ba23185fa34ceb4c3c50b7ed4fa51511265fe57c1ad6ee49f833007d
MD5 193ba3eaa405aa5b590e2d571b65167d
BLAKE2b-256 1fcbcb515d23128193ca36d27d2ca560784eddee1daed26881ee2130bc7acbd5

See more details on using hashes here.

File details

Details for the file stomper-0.2.2.linux-i686.tar.gz.

File metadata

File hashes

Hashes for stomper-0.2.2.linux-i686.tar.gz
Algorithm Hash digest
SHA256 6d84d4309a937bc62abe10fc68516dc876cc879fe55f29af108d9751b45ee6b8
MD5 6cff91aea4b3a4a294d520f728be5bad
BLAKE2b-256 eca9d677fa9b95bc525854cebfd049e04b4a6780693e61957de975da12ec5d45

See more details on using hashes here.

File details

Details for the file stomper-0.2.2-py2.6.egg.

File metadata

  • Download URL: stomper-0.2.2-py2.6.egg
  • Upload date:
  • Size: 53.8 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for stomper-0.2.2-py2.6.egg
Algorithm Hash digest
SHA256 d5b69410e42a82b651a6c5b7054fa73d8f561a13750b5d7f9c45471e3b42c739
MD5 83422adaae2ce27ba7a7f6dc2d2a2cb9
BLAKE2b-256 eb9d57ca7987f7cf55e580e226eaa8e3c992bcdf43618edf948b45730c9727f2

See more details on using hashes here.

File details

Details for the file stomper-0.2.2-py2.5.egg.

File metadata

  • Download URL: stomper-0.2.2-py2.5.egg
  • Upload date:
  • Size: 53.4 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for stomper-0.2.2-py2.5.egg
Algorithm Hash digest
SHA256 323397998a19736cc5d8869aec68578c684fc86b57ac22ae09e556baa8ac0075
MD5 c0f0ec8f3197f2925637b54c8a256fff
BLAKE2b-256 62fc44dbb5ba3d37c7d2f42f1ea8b13891f97c87a180bc4cbeae9b65ceb813bc

See more details on using hashes here.

File details

Details for the file stomper-0.2.2-py2.4.egg.

File metadata

  • Download URL: stomper-0.2.2-py2.4.egg
  • Upload date:
  • Size: 53.9 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for stomper-0.2.2-py2.4.egg
Algorithm Hash digest
SHA256 073964364ec88704bf164351530eb50ba3a7be26f035a8524fd9db57aa9e4749
MD5 7d8da4861aef4e15d8040a6026717448
BLAKE2b-256 56bb783b85d0abf79e796435e655607a02f7e3a69531f05831fdb53c5e25e06f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page