Commits

<h...@velum.net  committed 7bcfeed

  • Participants
  • Parent commits e40fc09

Comments (0)

Files changed (1)

-== Welcome ==
-
-Welcome to your wiki! This is the default page we've installed for your convenience. Go ahead and edit it.
-
-=== Wiki features ===
-
-This wiki uses the [[http://www.wikicreole.org/|Creole]] syntax, and is fully compatible with the 1.0 specification.
-
-The wiki itself is actually a hg repository, which means you can clone it, edit it locally/offline, add images or any other file type, and push it back to us. It will be live immediately.
-
-Go ahead and try:
-
-{{{
-$ hg clone http://bitbucket.org/hozn/stompclient/wiki
-}}}
-
-Wiki pages are normal files, with the .wiki extension. You can edit them locally, as well as creating new ones.
-
-=== Syntax highlighting ===
-
-You can also highlight snippets of text, we use the excellent [[http://www.pygments.org/|Pygments]] library.
-
-Here's an example of some Python code:
-
-{{{
-#!python
-
-def wiki_rocks(text):
-	formatter = lambda t: "funky"+t
-	return formatter(text)
-}}}
-
-You can check out the source of this page to see how that's done, and make sure to bookmark [[http://pygments.org/docs/lexers/|the vast library of Pygment lexers]], we accept the 'short name' or the 'mimetype' of anything in there.
-
-Have fun!
+= Stompclient =
+
+The *stompclient* project is a python 2.6+ client for interacting with  [[http://stomp.codehaus.org/|STOMP]] servers (aka brokers).
+
+It supports both a "simplex" (publish-only) client, for use in situations where you just need to send messages to a server (e.g. from the context of a request in a web application) and a "duplex" (publish-subscribe) implementation that supports receiving frames from the server.
+
+*stompclient* should work with any STOMP broker.  There's an [[http://stomp.codehaus.org/Brokers|official list of them]].  Personally, I will recommend giving [[http://code.google.com/p/coilmq/|CoilMQ]] a try (since I wrote it).
+
+== Install ==
+
+Currently this code is still pre-alpha, so packages have not been published.  You can get it from Mercurial.
+
+{{{
+shell$ hg clone https://bitbucket.org/hozn/stompclient
+shell$ cd stompclient
+shell$ python -m virtualenv --no-site-packages env
+shell$ source env/bin/activate
+(env) shell$ python setup.py develop
+}}}
+
+(The virtualenv part is more of a recommendation than a requirement.)
+
+
+== Quickstart ==
+
+Here is a simple-case example of using a client to push out a STOMP message:
+
+{{{
+#!python
+from stompclient import PublishClient
+
+client = PublishClient('127.0.0.1', 61613)
+client.connect()
+client.send('/queue/testing', 'This is the body.')
+client.disconnect()
+}}}
+
+Here's an example of using the {{{PublishSubscribeClient}}} in a multi-threaded context:
+
+{{{
+#!python
+import threading
+from stompclient import PublishSubscribeClient
+
+def frame_received(frame):
+  # Do something with the frame!
+  print "----Received Frame----\n%s\n-----" % frame
+
+client = PublishSubscribeClient('127.0.0.1', 61613)
+listener = threading.Thread(target=client.listen_forever)
+listener.start()
+
+client.subscribe("/queue/testing", frame_received)
+client.send("/queue/testing", "This is the body of the frame.")
+client.send("/queue/testing", '{"key": "Another frame example."}')
+client.disconnect()
+}}}
+
+Normally you probably wouldn't send messages to yourself ... but hopefully you get the idea :)