RabbitMQ

Erlang installation on Slackware

Requires Erlang:

Slackbuild

UNIX server installation

Python client

Examples

http://www.rabbitmq.com/tutorials/tutorial-one-python.html

   1 #!/usr/bin/env python
   2 import pika
   3 connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
   4 channel = connection.channel()
   5 channel.queue_declare(queue='hello')
   6 channel.basic_publish(exchange='',  routing_key='hello', body='Hello World!')
   7 print " [x] Sent 'Hello World!'"
   8 connection.close()

   1 #!/usr/bin/env python
   2 import pika
   3 connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
   4 channel = connection.channel()
   5 channel.queue_declare(queue='hello')
   6 print ' [*] Waiting for messages. To exit press CTRL+C'
   7 
   8 def callback(ch, method, properties, body):
   9     print " [x] Received %r" % (body,)
  10 
  11 channel.basic_consume(callback, queue='hello', no_ack=True)
  12 channel.start_consuming()

RabbitMQ (last edited 2014-08-12 11:41:57 by 195-23-86-114)