-
Install RabbitMQ and Management Plugin from:
-
In the RabbitMQ Management Web UI add:
-
A direct exchange called "postgres"
-
A queue called "transactions"
-
Bind the queue "transactions" to the exchange "postgres" with the routing key "pubish_transactions"
-
Create two databases:
-
createdb server
-
createdb client
-
Install pg_amqp in to the "server" database. PostgreSQL from:
https://labs.omniti.com/labs/pgtreats/browser/trunk/contrib/pg_amqp
or
easy_install pgxnclient pgxnclient install pg_amqp
then
psql server < pg_amqp.sql
-
Import the schemas
psql server < server.sql psql client < client.sql
-
Install pika, the Python RabbitMQ client library:
easy_install pika
Kick off all three apps in different terminals:
-
Kick off ./consumer.py
-
Kick off ./watcher.py
-
Kick off ./producer.py
I included a setup.sh file here if install the requirements, it will do all of the postgres specific schema setup and the pg_amqp.sql file included in the distro is copied from my contrib install of pg_amqp and your milage may vary.
I used PostgreSQL 9.0.3, RabbitMQ 2.4.1, pika 0.9.6pre0 (github master), psycopg2 2.4.1 and Python 2.6.1