.. Amity documentation master file, created by sphinx-quickstart on Mon Jun 27 20:23:14 2011. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. ====================================== Welcome to the documentation for Amity ====================================== Amity is a simple library to developing event driven systems using an AMQP backend. This library allows you to create simple emitter and listeners along with slightly more complex requesters and responders. The library also has built in support for django allowing you to extend signal outside of the web server and across the network. Quick start =========== Install and run rabbit-mq:: sudo apt-get install rabbitmq-server Install the amity library:: pip install -e git+t://github.com/a-musing-moose/amity.git#egg=amity Create a simple emitter:: from kombu.connection import BrokerConnection from amity.messaging import Event, Emitter connection = BrokerConnection('localhost', 'guest', 'guest', '/') emitter = Emitter(connection) emitter.emit('event.something', Event({"msg": "hello"})) And a simple listener:: from kombu.connection import BrokerConnection from amity.messaging import Event, Listener connection = BrokerConnection('localhost', 'guest', 'guest', '/') def on_message(event): print "%s says: %s" % (event.get_header("from"), event.get("msg")) listener = Listener(connection) listener.add_callback("event.something", on_message) listener.listen() Then simple run your 2 scripts in separate terminals. The listener will sit and listen for any events that come in. Such as those produced by your emitter. Contents: .. toctree:: :maxdepth: 2 getting_started working_with_django Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search`