arc/docs/badges/current_implementation_messages_consumer.rst

39 lines
1.9 KiB
ReStructuredText
Raw Permalink Normal View History

.. _current_implementation_messages_consumer:
Messages consumer
=================
The fedbadges fedmsg consumer is the main piece of Fedora Badges that grants badges to
the service users. It consumes every message from the fedmsg bus, checks to see if that
message matches a badge rule, and if it does, uses the Tahrir API (database API) to
issue the badge to the user in the database.
Many badge rules require the consumer to know about past messages too, not just the one
that triggered the rule. For example, a badge for 100 Bodhi comments requires a
historical count of bodhi comment messages from the Datanommer (every message sent,
ever) database. Note, however that currently the consumer interfaces directly with the
Datanommer database, rather than using Datagrepper (been assumed so for performance
reasons).
The badges rules are defined in YAML files are defined in a custom specification that is
documented in the `fedbadges documentation
<https://github.com/fedora-infra/fedbadges/blob/develop/README.rst>`_. For Fedora
Badges, the `badges rules are stored
<https://pagure.io/fedora-badges/blob/master/f/rules>`_ in the `Fedora Badges repo
<https://pagure.io/Fedora-Badges>`_ and when new rules are added, copied over to the
badges-backend01 server using the `pushes-badges manual playbook
<https://pagure.io/fedora-infra/ansible/blob/main/f/playbooks/manual/push-badges.yml>`_.
- Source repository: https://github.com/fedora-infra/fedbadges
- Production location: badges-backend01.iad2.fedoraproject.org
Note: The messages consumer has some code in the main development branch that appears to
start implementing support for Badgr. but this appears to be half-finished and was never
deployed to production. It also appears to only send badges to badgr, and not store them
in the tahrir database. So content can start here.
Technologies used
-----------------
The messages consumer is written in Python 2.