{"id":27603527,"url":"https://github.com/taskiq-python/taskiq-valkey","last_synced_at":"2025-07-22T03:33:51.100Z","repository":{"id":279967583,"uuid":"940574918","full_name":"taskiq-python/taskiq-valkey","owner":"taskiq-python","description":"Taskiq integration with valkey","archived":false,"fork":false,"pushed_at":"2025-05-05T16:45:00.000Z","size":65,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-10T18:22:46.097Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/taskiq-python.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-28T12:20:27.000Z","updated_at":"2025-06-27T14:00:42.000Z","dependencies_parsed_at":"2025-07-10T12:43:02.687Z","dependency_job_id":"77e36247-91de-4596-a554-4901b424837a","html_url":"https://github.com/taskiq-python/taskiq-valkey","commit_stats":null,"previous_names":["taskiq-python/taskiq-valkey"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/taskiq-python/taskiq-valkey","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskiq-python%2Ftaskiq-valkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskiq-python%2Ftaskiq-valkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskiq-python%2Ftaskiq-valkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskiq-python%2Ftaskiq-valkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taskiq-python","download_url":"https://codeload.github.com/taskiq-python/taskiq-valkey/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskiq-python%2Ftaskiq-valkey/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265367895,"owners_count":23753830,"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":[],"created_at":"2025-04-22T19:17:15.863Z","updated_at":"2025-07-22T03:33:51.091Z","avatar_url":"https://github.com/taskiq-python.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TaskIQ-Valkey\n\nTaskiq-valkey is a plugin for taskiq that adds a new broker and result backend based on valkey.\n\n# Installation\n\nTo use this project you must have installed core taskiq library:\n```bash\npip install taskiq\n```\nThis project can be installed using pip:\n```bash\npip install taskiq-valkey\n```\n\n# Usage\n\nLet's see the example with the valkey broker and valkey async result:\n\n```python\n# broker.py\nimport asyncio\n\nfrom taskiq_valkey import ValkeyAsyncResultBackend, ValkeyStreamBroker\n\nresult_backend = ValkeyAsyncResultBackend(\n    valkey_url=\"valkey://localhost:6379\",\n)\n\n# Or you can use PubSubBroker if you need broadcasting\nbroker = ValkeyStreamBroker(\n    valkey_url=\"valkey://localhost:6379\",\n).with_result_backend(result_backend)\n\n\n@broker.task\nasync def best_task_ever() -\u003e None:\n    \"\"\"Solve all problems in the world.\"\"\"\n    await asyncio.sleep(5.5)\n    print(\"All problems are solved!\")\n\n\nasync def main():\n    task = await best_task_ever.kiq()\n    print(await task.wait_result())\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\nLaunch the workers:\n`taskiq worker broker:broker`\nThen run the main code:\n`python3 broker.py`\n\n\n## Brokers\n\nThis package contains 6 broker implementations. We have two broker types: `PubSub` and `Stream`.\n\nEach of type is implemented for each valkey architecture:\n* Single node\n* Cluster\n* Sentinel\n\nHere's a small breakdown of how they differ from eachother.\n\n\n### PubSub\n\nBy default on old valkey versions PUBSUB was the way of making valkey into a queue.\nBut using PUBSUB means that all messages delivered to all subscribed consumers.\n\n\u003e [!WARNING]\n\u003e This broker doesn't support acknowledgements. If during message processing\n\u003e Worker was suddenly killed the message is going to be lost.\n\n### Stream\n\nStream brokers use valkey [stream type](https://valkey.io/topics/streams-intro/) to store and fetch messages.\n\n\u003e [!TIP]\n\u003e This broker **supports** acknowledgements and therefore is fine to use in cases when data durability is\n\u003e required.\n\n## ValkeyAsyncResultBackend configuration\n\nValkeyAsyncResultBackend parameters:\n* `valkey_url` - url to valkey.\n* `keep_results` - flag to not remove results from Valkey after reading.\n* `result_ex_time` - expire time in seconds (by default - not specified)\n* `result_px_time` - expire time in milliseconds (by default - not specified)\n* Any other keyword arguments are passed to `valkey.asyncio.BlockingConnectionPool`.\n  Notably, you can use `timeout` to set custom timeout in seconds for reconnects\n  (or set it to `None` to try reconnects indefinitely).\n\n\u003e [!WARNING]\n\u003e **It is highly recommended to use expire time in ValkeyAsyncResultBackend**\n\u003e If you want to add expiration, either `result_ex_time` or `result_px_time` must be set.\n\u003e ```python\n\u003e # First variant\n\u003e valkey_async_result = ValkeyAsyncResultBackend(\n\u003e     valkey_url=\"valkey://localhost:6379\",\n\u003e     result_ex_time=1000,\n\u003e )\n\u003e\n\u003e # Second variant\n\u003e valkey_async_result = ValkeyAsyncResultBackend(\n\u003e     valkey_url=\"valkey://localhost:6379\",\n\u003e     result_px_time=1000000,\n\u003e )\n\u003e ```\n\n\n## Schedule sources\n\n\nYou can use this package to add dynamic schedule sources. They are used to store\nschedules for taskiq scheduler.\n\nThe advantage of using schedule sources from this package over default `LabelBased` source is that you can\ndynamically add schedules in it.\n\nFor now we have only one type of schedules - `ListValkeyScheduleSource`.\n\n### ListValkeyScheduleSource\n\nThis source holds values in lists.\n\n* For cron tasks it uses key `{prefix}:cron`.\n* For timed schedules it uses key `{prefix}:time:{time}` where `{time}` is actually time where schedules should run.\n\nThe main advantage of this approach is that we only fetch tasks we need to run at a given time and do not perform any excesive calls to valkey.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskiq-python%2Ftaskiq-valkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaskiq-python%2Ftaskiq-valkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskiq-python%2Ftaskiq-valkey/lists"}