This repository has been archived by the owner. It is now read-only.
Code for my lightning talk at pgCon 2011
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
client.sql
consumer.py
pg_amqp.sql
producer.py
server.sql
setup.sh
watcher.py

README.md

On Rabbits and Elephants

Installation

  1. Install RabbitMQ and Management Plugin from:

    http://www.rabbitmq.com

  2. In the RabbitMQ Management Web UI add:

  3. A direct exchange called "postgres"

  4. A queue called "transactions"

  5. Bind the queue "transactions" to the exchange "postgres" with the routing key "pubish_transactions"

  6. Create two databases:

  7. createdb server

  8. createdb client

  9. 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
    
  10. Import the schemas

     psql server < server.sql
     psql client < client.sql
    
  11. Install pika, the Python RabbitMQ client library:

     easy_install pika
    

Use

Kick off all three apps in different terminals:

  1. Kick off ./consumer.py

  2. Kick off ./watcher.py

  3. Kick off ./producer.py

Notes

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