Skip to content

Latest commit

 

History

History
54 lines (34 loc) · 1.58 KB

README.md

File metadata and controls

54 lines (34 loc) · 1.58 KB

Erlang code for RabbitMQ tutorials

Here you can find a Erlang code examples from RabbitMQ tutorials.

This code is using RabbitMQ Erlang Client (User Guide).

Requirements

To run this code you need at least Erlang R13B03, on Ubuntu you can get it using apt:

sudo apt-get install erlang

You need Erlang Client binaries:

wget http://www.rabbitmq.com/releases/rabbitmq-erlang-client/v2.7.0/rabbit_common-2.7.0.ez
unzip rabbit_common-2.7.0.ez
ln -s rabbit_common-2.7.0 rabbit_common

wget http://www.rabbitmq.com/releases/rabbitmq-erlang-client/v2.7.0/amqp_client-2.7.0.ez
unzip amqp_client-2.7.0.ez
ln -s amqp_client-2.7.0 amqp_client

Code

Tutorial one: "Hello World!":

./send.erl
./receive.erl

Tutorial two: Work Queues:

./new_task.erl "A very hard task which takes two seconds.."
./worker.erl

Tutorial three: Publish/Subscribe:

./receive_logs.erl
./emit_log.erl "info: This is the log message"

Tutorial four: Routing:

./receive_logs_direct.erl info
./emit_log_direct.erl info Hello

Tutorial five: Topics:

./receive_logs_topic.erl "*.rabbit"
./emit_log_topic.erl red.rabbit Hello