Size: 563
Comment:
|
Size: 2048
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 13: | Line 13: |
* installpkg | * installpkg /tmp/erlang-otp-13B03-i486-1_SBo.tgz == Slackbuild == * wget http://slackbuilds.org/slackbuilds/14.1/development/erlang-otp.tar.gz * tar xvzf erlang-otp.tar.gz * cd erlang-otp * wget http://www.erlang.org/download/otp_src_R16B02.tar.gz * wget http://www.erlang.org/download/otp_doc_man_R16B02.tar.gz * ./erlang-otp.SlackBuild * installpkg /tmp/erlang-otp-16B02-x86_64-1_SBo.tgz |
Line 16: | Line 25: |
Get http://www.rabbitmq.com/releases/rabbitmq-server/v3.3.1/rabbitmq-server-generic-unix-3.3.1.tar.gz | * cd /opt * wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.3.1/rabbitmq-server-generic-unix-3.3.1.tar.gz * tar xvzf rabbitmq-server-generic-unix-3.3.1.tar.gz * ln -s rabbitmq_server-3.3.1 rabbitmq * /opt/rabbitmq/sbin/rabbitmq-server |
Line 18: | Line 31: |
Extract it into /opt/rabbitmq | == Python client == * pip install pika # python client == Examples == http://www.rabbitmq.com/tutorials/tutorial-one-python.html '''Producer''' {{{#!highlight python #!/usr/bin/env python import pika connection = pika.BlockingConnection(pika.ConnectionParameters('localhost')) channel = connection.channel() channel.queue_declare(queue='hello') channel.basic_publish(exchange='', routing_key='hello', body='Hello World!') print " [x] Sent 'Hello World!'" connection.close() }}} '''Consumer''' {{{#!highlight python #!/usr/bin/env python import pika connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) channel = connection.channel() channel.queue_declare(queue='hello') print ' [*] Waiting for messages. To exit press CTRL+C' def callback(ch, method, properties, body): print " [x] Received %r" % (body,) channel.basic_consume(callback, queue='hello', no_ack=True) channel.start_consuming() }}} |
RabbitMQ
Erlang installation on Slackware
Requires Erlang:
- su
- cd /tmp
wget http://slackbuilds.org/slackbuilds/13.0/development/erlang-otp.tar.gz
- tar xvzf erlang-otp.tar.gz
- cd erlang-otp
wget http://www.erlang.org/download/otp_doc_man_R13B03.tar.gz
./erlang-otp.SlackBuild
- installpkg /tmp/erlang-otp-13B03-i486-1_SBo.tgz
Slackbuild
wget http://slackbuilds.org/slackbuilds/14.1/development/erlang-otp.tar.gz
- tar xvzf erlang-otp.tar.gz
- cd erlang-otp
wget http://www.erlang.org/download/otp_doc_man_R16B02.tar.gz
./erlang-otp.SlackBuild
- installpkg /tmp/erlang-otp-16B02-x86_64-1_SBo.tgz
UNIX server installation
- cd /opt
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.3.1/rabbitmq-server-generic-unix-3.3.1.tar.gz
- tar xvzf rabbitmq-server-generic-unix-3.3.1.tar.gz
- ln -s rabbitmq_server-3.3.1 rabbitmq
- /opt/rabbitmq/sbin/rabbitmq-server
Python client
- pip install pika # python client
Examples
http://www.rabbitmq.com/tutorials/tutorial-one-python.html
Producer
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()
Consumer
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()