Aller au contenu

Quickstart Bus

Ajouter la capability RabbitMQ et vérifier le bootstrap bus.

Prérequis

  • Python 3.13
  • uv
  • Docker

Étapes

Si tu n'as pas encore de projet :

Bash
1
2
3
uvx --from arclith-cli arclith-cli init todo-bus --dir .
cd todo-bus
uv sync
Bash
1
2
3
docker run --rm -d --name arclith-rabbitmq \
  -p 5672:5672 -p 15672:15672 \
  rabbitmq:4-management

Dans le projet Arclith :

Bash
1
2
3
4
5
uv add "arclith[rabbitmq]"
uvx --from arclith-cli arclith-cli add-adapter \
  --capability command-bus \
  --adapter rabbitmq \
  --yes

Validation Bootstrap

Bash
1
2
3
4
5
6
7
uv run python - <<'PY'
from arclith import Arclith

app = Arclith("config")
assert app.config.command_bus.is_enabled("rabbitmq")
print(app.config.command_bus.rabbitmq.queue)
PY

Résultat

La configuration bus est chargée et RabbitMQ est actif côté Arclith.

Runner Projet

Pour consommer réellement des messages, le projet doit ajouter un CommandHandler, un CommandDispatcher, puis appeler arclith.run_command_bus(dispatcher).

Nettoyage

Bash
docker rm -f arclith-rabbitmq

Média

Média à produire

Capture : console RabbitMQ Management. Vidéo : ajout de la capability puis lancement worker.

Suite

Lire Agent, puis command-bus/rabbitmq.