Metadata-Version: 2.1
Name: py-rodo
Version: 0.0.1
Summary: Helper library to process messages on rabbit.opensuse.org
License: LGPL-2.1-or-later
Author: Dan Čermák
Author-email: dcermak@suse.com
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: dataclassy (>=1.0.1)
Requires-Dist: pika (>=1.3.2)
Description-Content-Type: text/x-rst

py-rodo aka py-rabbit-opensuse-org
==================================

This is a small helper library to process messages emitted to
`rabbit.opensuse.org <https://rabbit.opensuse.org/>`_ by the Open Build Service.


Usage
-----

.. warning::
   This library is experimental and is the product of trial & error
   experimentation. Proceed with caution.

The main entry point for this library is the `QueueProcessor` class, which
listens to the message bus, processes messages and invokes user defined
callbacks depending on the message routing keys.

The message callback functions receive a child class of
`ObsMessageBusPayloadBase` as the single argument and should return nothing. The
specific subtype of `ObsMessageBusPayloadBase` can be infered from the
dictionary `QUEUE_TO_PAYLOAD_TYPE` which maps the routing keys to specific
payload types.

To only process package commit messages, create the following callback:

.. code-block:: python

   def commit_to_my_package(payload: PackageCommitPayload) -> None:
       # process the payload here

   callbacks = {RoutingKey.PACKAGE_COMMIT: commit_to_my_package}

   qp = QueueProcessor(callbacks=callbacks)
   qp.listen_forever()

