Installation

Installing the library

Create a Python virtual environment:

mkdir fedora-messaging-tutorial
cd fedora-messaging-tutorial
mkvirtualenv -p python3 -a `pwd` fedora-messaging-tutorial
workon fedora-messaging-tutorial

Install the library and its dependencies:

pip install fedora-messaging
# Alternatively, install it directly from the git repository
git clone https://github.com/fedora-infra/fedora-messaging.git
cd fedora-messaging
pip install -e .

Make sure it is available and working:

fedora-messaging --help

Setting up RabbitMQ

Install RabbitMQ and start it:

dnf install rabbitmq-server
systemctl start rabbitmq-server

Enable RabbitMQ web admin interface:

rabbitmq-plugins enable rabbitmq_management

RabbitMQ has a web admin interface that you can access at: http://localhost:15672/. The username is guest and the password is guest. This interface lets you change the configuration, send messages and read the messages in the queues. Keep it open in a browser tab, we’ll need it later.

If your project uses containers, consult the RabbitMQ documentation about containers.

Configuration

An example of the library configuration file is provided in the config.toml.example file. Copy that file to /etc/fedora-messaging/config.toml to make it available system-wide. Alternatively, you can copy it to config.toml anywhere and set the FEDORA_MESSAGING_CONF environement variable to that file’s path.

Refer to the documentation for a complete description of the configuration options.

Comment out the callback and bindings options, and all the [exchanges.custom_exchange] and [queues.my_queue] sections.

In the [client_properties] section, change the app value to Fedora Messaging tutorial.