{"id":13705585,"url":"https://github.com/Relrin/sanic-amqp-extension","last_synced_at":"2025-05-05T16:33:16.850Z","repository":{"id":57463818,"uuid":"123684296","full_name":"Relrin/sanic-amqp-extension","owner":"Relrin","description":"AMQP support for Sanic framework","archived":false,"fork":false,"pushed_at":"2022-12-20T10:05:24.000Z","size":10,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-07T14:22:48.932Z","etag":null,"topics":["amqp","extension","python","sanic"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Relrin.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-03T11:05:24.000Z","updated_at":"2022-12-20T10:01:30.000Z","dependencies_parsed_at":"2023-01-30T00:16:02.566Z","dependency_job_id":null,"html_url":"https://github.com/Relrin/sanic-amqp-extension","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Relrin%2Fsanic-amqp-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Relrin%2Fsanic-amqp-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Relrin%2Fsanic-amqp-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Relrin%2Fsanic-amqp-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Relrin","download_url":"https://codeload.github.com/Relrin/sanic-amqp-extension/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224455892,"owners_count":17314200,"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":["amqp","extension","python","sanic"],"created_at":"2024-08-02T22:00:44.212Z","updated_at":"2024-11-13T13:30:41.379Z","avatar_url":"https://github.com/Relrin.png","language":"Python","funding_links":[],"categories":["Extensions"],"sub_categories":["Queues"],"readme":"sanic-amqp-extension\n####################\nAMQP support for Sanic framework\n\nFeatures\n========\n- Based on the aioamqp_ library\n- Provides an opportunity to implement workers that works in background\n\nInstallation\n============\nThis package should be installed using pip: ::\n\n    pip install sanic-amqp-extension\n\nExample\n=======\n.. code-block:: python\n\n    from sanic import Sanic, response\n    from sanic_amqp_ext import AmqpExtension, AmqpWorker\n\n\n    app = Sanic(__name__)\n    # Configuration for RabbitMQ\n    app.config.update({\n        \"AMQP_USERNAME\": \"guest\",\n        \"AMQP_PASSWORD\": \"guest\",\n        \"AMQP_HOST\": \"localhost\",\n        \"AMQP_PORT\": 5672,\n        \"AMQP_VIRTUAL_HOST\": \"vhost\",\n        \"AMQP_USING_SSL\": False,\n    })\n    AmqpExtension(app) # AMQP is available as `app.amqp` or `app.extensions['amqp']`\n\n\n    class CustomWorker(AmqpWorker):\n\n        async def run(self, *args, **kwargs):\n            transport, protocol = await self.connect()  # create a new connection\n            # and do some stuff here ...\n\n    # Register workers after initializing the extension\n    app.amqp.register_worker(CustomWorker(app))\n\n\n    @app.route(\"/\")\n    async def handle(request):\n        transport, protocol = await request.app.amqp.connect()  # create a new connection\n        # do some stuff here ...\n        # P.S. but don't forget to close the connection after using\n        return response.text(\"It's works!\")\n\nLicense\n=======\nThe sanic-amqp-extension is published under BSD license. For more details read LICENSE_ file.\n\n.. _links:\n.. _aioamqp: http://aioamqp.readthedocs.io/\n.. _LICENSE: https://github.com/Relrin/sanic-amqp-extension/blob/master/LICENSE\n\nReal project examples\n=====================\nOpen Matchmaking project:  \n\n- `Auth/Auth microservice \u003chttps://github.com/OpenMatchmaking/microservice-auth/\u003e`_\n- `Game servers pool microservice \u003chttps://github.com/OpenMatchmaking/microservice-game-servers-pool/\u003e`_\n- `Player statistics microservice \u003chttps://github.com/OpenMatchmaking/microservice-player-statistics/\u003e`_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRelrin%2Fsanic-amqp-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRelrin%2Fsanic-amqp-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRelrin%2Fsanic-amqp-extension/lists"}