This is a workshop through out which one develops a simple RabbitMQ applicaiton in Elixir.
- School of RabbitMQ in Elixir
- master holds the end solution
- each step has its own branch
- the branches are named with
step/{ORIDINAL}-{EXERCISE-SHORT-DESC}
, e.g. (step/0-connect-to-rabbit
) - the beginning of a branch is tagged with
step-{ORIDINAL}-start
, e.g. (step-0-start
) to see what a completion of one step takes via a diff - HEAD of a branch contains the final state for the step
- if a "step branch" changes, it is merged to master and possibly the master has to be merged to all the subsequent "step branches"
- the branches are named with
- README at the master branch holds instructions to the correspondins steps
To complete the workshop an instance of the RabbitMQ server is required. One
can be started with docker using the docker-compose.yml
provided: docker-compose up
.
This will spawn a RabbitMQ container and
create the following ports bindings (host->container): 5672:5672
and 15672:15672
.
They are used for AMQP and RabbitMQ server Managment UI respectively
(http://localhost:15672).
- Open
test/rabbit_hole/protocol/connection_test.exs
to see how a connection is established and channels are opened - Run the tests:
mix test test/rabbit_hole/protocol/connection_test.exs
- Open
test/rabbit_hole/protocol/queue_declare_test.exs
to see how a queue is declared - Run the tests
mix test test/rabbit_hole/protocol/queue_declare_test.exs
-
Open
test/rabbit_hole/protocol/publish_consume_test.exs
to see how a message can be published to and consumed from a queue -
Run the tests
mix test test/rabbit_hole/protocol/publish_consume_test.exs
-
Comment out the queue deletion operation in the first test in
test/rabbit_hole/protocol/publish_consume_test.exs
, run it:mix test test/rabbit_hole/protocol/publish_consume_test.exs:23
and see the message enqueued in the my_queue
through the the management UI: http://localhost:15672/#/queues
(user/pass: guest/guest).
- Checkout at step-1-start tag:
git checkout step-1-start
. - Open
test/rabbit_hole/producer_consumer_test.exs
and see the expected behaviour of theRabbitHole.Producer
and theRabbitHole.Consumer
. - Implement the producer and consumer modules.
- Check the solution by looking at the diff between the tag and the head of the 1-simple-producer-consumer branch: step-1-start...step/1-simple-producer-consumer.
- Open
test/rabbit_hole/protocol/exchange_declare_test.exs
to see how to declare an exchange. - Run the tests:
mix test --trace test/rabbit_hole/protocol/exchange_declare_test.exs
.
- Checkout at step-2-start tag:
git checkout step-2-start
. - Open
test/rabbit_hole/task/producer_consumer_test.exs
and see the expected behaviour of theRabbitHole.Task.Producer
and theRabbitHole.Task.Consumer
. - Implement the producer and consumer modules.
- Check the solution by looking at the diff between the tag and the head of the 2-message-routing: step-2-start...step/2-message-routing.
- Open
test/rabbit_hole/protocol/publish_with_confirm_test.exs
to see how to use the Publisher confirms. - Run the tests:
mix test --trace test/rabbit_hole/protocol/publish_with_confirm_test.exs
- Open
test/rabbit_hole/protocol/consume_with_ack_test.exs
to see how to use the Publisher confirms. - Run the tests:
mix test --trace test/rabbit_hole/protocol/consume_with_ack_test.exs
- Checkout at step-3-start tag:
git checkout step-3-start
. - Open
test/rabbit_hole/task/producer_consumer_with_data_integrity_test.exs
and see the expected behaviour of theRabbitHole.Task.Producer
and theRabbitHole.Task.Consumer
with added Publisher Confirms and Consumer Acks respectively. - Extend the producer and consumer modules.
- Check the solution by looking at the diff between the tag and the head of the 3-data-integrity: step-3-start...step/3-data-integrity.