rabbitmq-tutorials/python
Hervé Beraud 916b37beb0 Ensure to always use pip as a module of a given version of python
Prefer to use pip as a module, it's avoid error and mistakes during
package installation. With this approach we are always sure to
to install dependencies in the right python environment.
2019-08-05 18:42:47 +02:00
..
emit_log_direct.py Bug fix 2019-07-18 11:19:06 +03:00
emit_log_topic.py Update for Pika 1.0.0, yapf formatting 2019-02-11 09:56:04 -08:00
emit_log.py Update for Pika 1.0.0, yapf formatting 2019-02-11 09:56:04 -08:00
new_task.py Update for Pika 1.0.0, yapf formatting 2019-02-11 09:56:04 -08:00
README.md Ensure to always use pip as a module of a given version of python 2019-08-05 18:42:47 +02:00
receive_logs_direct.py Explicitly use queue parameter name 2019-06-07 10:51:04 -07:00
receive_logs_topic.py Explicitly use queue parameter name 2019-06-07 10:51:04 -07:00
receive_logs.py Explicitly use queue parameter name 2019-06-07 10:51:04 -07:00
receive.py Update for Pika 1.0.0, yapf formatting 2019-02-11 09:56:04 -08:00
rpc_client.py Explicitly use queue parameter name 2019-06-07 10:51:04 -07:00
rpc_server.py Update for Pika 1.0.0, yapf formatting 2019-02-11 09:56:04 -08:00
send.py Update for Pika 1.0.0, yapf formatting 2019-02-11 09:56:04 -08:00
worker.py Update for Pika 1.0.0, yapf formatting 2019-02-11 09:56:04 -08:00

Python code for RabbitMQ tutorials

Here you can find Python code examples from RabbitMQ tutorials.

To successfully use the examples you will need a running RabbitMQ server.

Requirements

To run this code you need to install the pika package version 1.0.0 or later. To install it, run

python -m pip install pika

You may first need to run

python -m ensurepip

Code

Tutorial one: "Hello World!":

python send.py
python receive.py

Tutorial two: Work Queues:

python new_task.py "A very hard task which takes two seconds.."
python worker.py

Tutorial three: Publish/Subscribe:

python receive_logs.py
python emit_log.py "info: This is the log message"

Tutorial four: Routing:

python receive_logs_direct.py info
python emit_log_direct.py info "The message"

Tutorial five: Topics:

python receive_logs_topic.py "*.rabbit"
python emit_log_topic.py red.rabbit Hello

Tutorial six: RPC:

python rpc_server.py
python rpc_client.py