{"id":15576256,"url":"https://github.com/parikls/asyncio-red","last_synced_at":"2026-02-27T15:43:09.611Z","repository":{"id":57412153,"uuid":"445147831","full_name":"parikls/asyncio-red","owner":"parikls","description":"Powers yours microservices with event driven approach using Redis as a backend.","archived":false,"fork":false,"pushed_at":"2025-01-05T11:29:01.000Z","size":79,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T20:13:40.003Z","etag":null,"topics":["async-event-bus","asyncio","event-driven","event-driven-architecture","event-driven-microservices","eventbus","events","events-management","microservice","microservice-framework","microservices","microservices-architecture","python","python-async","python-asyncio","python3","redis","redis-channels","redis-list","redis-streams"],"latest_commit_sha":null,"homepage":"https://parikls.github.io/asyncio-red/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parikls.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-01-06T11:36:43.000Z","updated_at":"2025-01-05T11:29:04.000Z","dependencies_parsed_at":"2024-12-06T09:08:03.533Z","dependency_job_id":"69a66a49-7604-4fda-a3bb-44e7095a36a2","html_url":"https://github.com/parikls/asyncio-red","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"f959b529a33f5fb1549b8b7be9fb2f75d00629b7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parikls%2Fasyncio-red","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parikls%2Fasyncio-red/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parikls%2Fasyncio-red/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parikls%2Fasyncio-red/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parikls","download_url":"https://codeload.github.com/parikls/asyncio-red/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248316039,"owners_count":21083369,"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":["async-event-bus","asyncio","event-driven","event-driven-architecture","event-driven-microservices","eventbus","events","events-management","microservice","microservice-framework","microservices","microservices-architecture","python","python-async","python-asyncio","python3","redis","redis-channels","redis-list","redis-streams"],"created_at":"2024-10-02T18:44:32.186Z","updated_at":"2026-02-27T15:43:04.584Z","avatar_url":"https://github.com/parikls.png","language":"Python","readme":"asyncio-RED (Redis Event Driven)\n================================\n\nPowers your microservices with event driven approach using redis as a backend.\n\nSupport both publishing and subscribing using lists, channels and streams.\n\n`pydantic` is being used for events validation.\n\n`s3` can be used for sharing event schemas between services.\n\nInstallation\n------------\n\n- `pip install asyncio-red`\n\n\nSimple producer\n---------------\n\n```python\nfrom redis.asyncio import Redis\nfrom asyncio_red import RED, Via, BaseEvent\nfrom pydantic import Field\n\nclass EventV1List(BaseEvent):\n    key: str = Field(..., title='Key description')\n    \n\nclass EventV1Channel(BaseEvent):\n    key: str = Field(..., title='Key description')\n    \n    \nclass EventV1Stream(BaseEvent):\n    key: str = Field(..., title='Key description')\n\n    \nredis_client = Redis()\nred = RED(app_name=str('service_1'), redis_client=redis_client)\n\nred.add_out(\n    event=EventV1List,\n    via=Via.LIST,\n    target_name='events_list'\n)\n\nred.add_out(\n    event=EventV1Channel,\n    via=Via.CHANNELS,\n    target_name='events_channel'\n)\n\nred.add_out(\n    event=EventV1Stream,\n    via=Via.STREAMS,\n    target_name='events_stream'\n)\n\n\nasync def your_awesome_function():\n    # dispatch events\n    await EventV1List(key='value').dispatch()  # this one will be put to a list\n    await EventV1Channel(key='value').dispatch()  # this one will be pushed to a channel\n    await EventV1Stream(key='value').dispatch()  # this one will be pushed to a stream\n```\n\n\nSimple consumer\n--------------\n\n```python\nfrom redis.asyncio import Redis\nfrom asyncio_red import RED, Via, BaseEvent\nfrom pydantic import Field\n\nclass EventV1List(BaseEvent):\n    key: str = Field(..., title='Key description')\n    \n\nclass EventV1Channel(BaseEvent):\n    key: str = Field(..., title='Key description')\n    \n    \nclass EventV1Stream(BaseEvent):\n    key: str = Field(..., title='Key description')\n    \n\nredis_client = Redis()\nred = RED(app_name=str('service_2'), redis_client=redis_client)\n\n\nasync def event_handler(event):\n    print(event)\n\n\nred.add_in(\n    event=EventV1List,\n    via=Via.LIST,\n    handlers=(event_handler, ),\n    list_name=\"events_list\",\n)\n\nred.add_in(\n    event=EventV1Channel,\n    via=Via.CHANNELS,\n    handlers=(event_handler, ),\n    error_handler=event_handler,\n    channel_name=\"events_channel\"\n)\n\nred.add_in(\n    event=EventV1Stream,\n    via=Via.STREAMS,\n    handlers=(event_handler, event_handler),\n    stream_name=\"events_stream\",\n    group_name=\"events_group\",\n    consumer_name=\"consumer_name\"\n)\n\nawait red.run()\n```\n\n\nShared events registry\n----------------------\n\nThere is a possibility to keep event schemas registry on the S3 and share the schema across \ndifferent services. You'll need an AWS account and keys with access to S3.\n\n- Go to app root dir and initialize asyncio-red:\n\n```shell\nasyncio_red init --app-name=\u003capp name\u003e --s3-bucket=\u003cbucket name\u003e\n```\n\nThis will create an initial structure.\nDefine your events at `red/registry/\u003capp name\u003e.py`:\n\n```python\nfrom pydantic import Field\nfrom asyncio_red.events import BaseEvent\n\n\nclass EventV1List(BaseEvent):\n    key: str = Field(..., title='Key description')\n    \n\nclass EventV1Channel(BaseEvent):\n    key: str = Field(..., title='Key description')\n    \n    \nclass EventV1Stream(BaseEvent):\n    key: str = Field(..., title='Key description')\n\n```\n\n- push application events schemas to a registry: `asyncio-red push`\n- on a different service you can pull shared schemas - do the same steps, e.g. init structure and run `asyncio-red pull`\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparikls%2Fasyncio-red","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparikls%2Fasyncio-red","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparikls%2Fasyncio-red/lists"}