{"id":15654458,"url":"https://github.com/nidhaloff/b-rabbit","last_synced_at":"2025-12-14T14:58:14.472Z","repository":{"id":37853186,"uuid":"203605691","full_name":"nidhaloff/b-rabbit","owner":"nidhaloff","description":"A thread safe library that aims to provide a simple API for interfacing with RabbitMQ. Built on top of rabbitpy, the library make it very easy to use the RabbitMQ message broker with just few lines of code. It implements all messaging pattern used by message brokers","archived":false,"fork":false,"pushed_at":"2023-04-01T09:29:33.000Z","size":1844,"stargazers_count":31,"open_issues_count":4,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T23:48:40.834Z","etag":null,"topics":["client-server-architecture","concurency","distributed-systems","hacktoberfest","hacktoberfest2021","loose-coupling","message-broker","message-queues","microservices","microservices-architecture","mircroservice","multithreading","parallel-computing","rabbit-mq","rabbitmq","rabbitpy","thread-safe"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nidhaloff.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst"},"funding":{"github":"nidhaloff"}},"created_at":"2019-08-21T14:50:42.000Z","updated_at":"2025-02-08T16:10:10.000Z","dependencies_parsed_at":"2023-12-19T04:22:37.546Z","dependency_job_id":"1dc9165d-f390-4882-881d-3b81f25e2d13","html_url":"https://github.com/nidhaloff/b-rabbit","commit_stats":{"total_commits":127,"total_committers":7,"mean_commits":"18.142857142857142","dds":"0.18110236220472442","last_synced_commit":"972413a5878001100ab134d63bea4fae9ff83ff8"},"previous_names":["nidhaloff/b_rabbit"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nidhaloff%2Fb-rabbit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nidhaloff%2Fb-rabbit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nidhaloff%2Fb-rabbit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nidhaloff%2Fb-rabbit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nidhaloff","download_url":"https://codeload.github.com/nidhaloff/b-rabbit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251801086,"owners_count":21645968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client-server-architecture","concurency","distributed-systems","hacktoberfest","hacktoberfest2021","loose-coupling","message-broker","message-queues","microservices","microservices-architecture","mircroservice","multithreading","parallel-computing","rabbit-mq","rabbitmq","rabbitpy","thread-safe"],"created_at":"2024-10-03T12:51:52.998Z","updated_at":"2025-12-14T14:58:14.405Z","avatar_url":"https://github.com/nidhaloff.png","language":"Python","funding_links":["https://github.com/sponsors/nidhaloff"],"categories":[],"sub_categories":[],"readme":"========\nb-rabbit\n========\n\n.. image:: assets/b-rabbit.png\n    :width: 100\n    :align: center\n    :alt: b-rabbit-icon\n\n.. image:: https://img.shields.io/pypi/v/b-rabbit.svg\n        :target: https://pypi.python.org/pypi/b-rabbit\n\n.. image:: https://img.shields.io/travis/nidhaloff/b_rabbit.svg\n        :target: https://travis-ci.com/nidhaloff/b-rabbit\n\n.. image:: https://readthedocs.org/projects/b-rabbit/badge/?version=latest\n        :target: https://b-rabbit.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://img.shields.io/pypi/pyversions/b-rabbit\n        :alt: PyPI - Python Version\n        :target: https://b-rabbit.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://img.shields.io/pypi/wheel/b-rabbit\n        :alt: PyPI - Wheel\n        :target: https://pypi.python.org/pypi/b-rabbit\n\n\n.. image:: https://pepy.tech/badge/b-rabbit\n    :target: https://pepy.tech/project/b-rabbit\n\n.. image:: https://img.shields.io/twitter/url?url=https%3A%2F%2Ftwitter.com%2FNidhalBaccouri\n        :alt: Twitter URL\n        :target: https://twitter.com/NidhalBaccouri\n\n\n\n\nRabbitMQ without headache.\n---------------------------\n\nb-rabbit is a RabbitMq client library that aims to make interfacing with RabbitMQ easier. It is very useful especially\ninside large projects, in which many boilerplate code must be written.\n\nI started this project when I was working on a large microservices-based project in a large team.\nI decided to open-source the project afterwards.\n\n\n\n* Free software: MIT license\n* Documentation: https://b-rabbit.readthedocs.io.\n\nFeatures\n--------\n\n- it implements all RabbitMQ messaging patterns.\n- provides an easy high level API (take a look at the examples)\n- thread safe\n\nWhen you should use it\n----------------------\n- if you are having problems with other non thread safe libraries (like I did)\n- if you want to develop fast by using a high level API\n- if you don't want to write much code and save much time\n- if you want to use multithreading\n\n\nQuick Usage\n------------\n\nimport the library:\n\n.. code-block:: python\n\n\n    from b_rabbit import BRabbit\n\ncreate a parent instance which provide a global rabbitMQ connection\n\n.. code-block:: python\n\n    rabbit = BRabbit(host='localhost', port=5672)\n\nnow, just one liner to publish a message:\n\n.. code-block:: python\n\n    publisher = rabbit.EventPublisher(b_rabbit=rabbit,\n                                      publisher_name='pub').publish(routing_key='testing.test',\n                                                                    payload='Hello from publisher')\n\n\n\nor if you want to subscribe and listen to a certain topic:\n\n.. code-block:: python\n\n     def callback(msg):\n        # do something with the received msg from the publisher\n        print(f\"msg received: {msg}\")\n\n    # subscribe and run a listener in a thread\n\n    subscriber = rabbit.EventSubscriber(\n                                    b_rabbit=rabbit,\n                                    routing_key='testing.test',\n                                    publisher_name='pub',\n                                    event_listener=callback).subscribe_on_thread()\n\nAdvanced Usage using RPC\n--------------------------\n\n- task requester\n\n.. code-block:: python\n\n    from b_rabbit import BRabbit\n\n\n    def taskResponseListener(body):\n        print('Task Response received')\n        print(str(body))\n\n\n    rabbit = BRabbit(host='localhost', port=5672)\n    taskRequesterSynchron = rabbit.TaskRequesterSynchron(b_rabbit=rabbit,\n                                                         executor_name='test',\n                                                         routing_key='testing.test',\n                                                         response_listener=taskResponseListener)\n\n    taskRequesterSynchron.request_task('msg from requester')\n    rabbit.close_connection()\n\n- task responser (server)\n\n.. code-block:: python\n\n    from b_rabbit import BRabbit\n    import time\n\n    rabbit = BRabbit(host='localhost', port=5672)\n\n\n    def taskListener(server, body):\n        print('Task Request received')\n        print(str(body))\n        time.sleep(5)\n        server.send_return(payload=\"return this value to requester\")\n\n\n    taskExecuter = rabbit.TaskExecutor(b_rabbit=rabbit,\n                                       executor_name='test',\n                                       routing_key='testing.test',\n                                       task_listener=taskListener).run_task_on_thread()\n\n\nFurther\n--------\n\nTake a look in the examples folder for more. b_rabbit implements also the remote procedure call (RPC) pattern\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnidhaloff%2Fb-rabbit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnidhaloff%2Fb-rabbit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnidhaloff%2Fb-rabbit/lists"}