{"id":15555247,"url":"https://github.com/brews/redis_queue","last_synced_at":"2025-03-29T02:44:49.922Z","repository":{"id":249340892,"uuid":"831245934","full_name":"brews/redis_queue","owner":"brews","description":"Demo containerized HTTP server and workers with Redis/Valkey job queue. Written in Rust with Axum and Tokio.","archived":false,"fork":false,"pushed_at":"2024-07-20T04:25:22.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T23:34:47.405Z","etag":null,"topics":["axum","example","redis","rust","tokio","valkey"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/brews.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}},"created_at":"2024-07-20T03:10:36.000Z","updated_at":"2024-07-20T04:25:26.000Z","dependencies_parsed_at":"2024-07-20T05:18:57.153Z","dependency_job_id":null,"html_url":"https://github.com/brews/redis_queue","commit_stats":null,"previous_names":["brews/rust_redis_queue_demo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brews%2Fredis_queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brews%2Fredis_queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brews%2Fredis_queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brews%2Fredis_queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brews","download_url":"https://codeload.github.com/brews/redis_queue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246131244,"owners_count":20728299,"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":["axum","example","redis","rust","tokio","valkey"],"created_at":"2024-10-02T15:07:31.685Z","updated_at":"2025-03-29T02:44:49.903Z","avatar_url":"https://github.com/brews.png","language":"Rust","readme":"# redis_queue\n\nDemo containerized HTTP server and workers with Redis/Valkey job queue. Written in Rust with Axum and Tokio.\n\n## More details?\n\nThis is a small Rust web application. It can run as either an HTTP server or a worker, depending on whether the `APP_TYPE` environment variable is set to \"server\" or \"worker.\" \n\nAs a server, it accepts work through HTTP POST requests, adding jobs to a Valkey (Redis) queue. This queue is occasionally polled by separately run workers who log their results to stdout.\n\n```mermaid\nflowchart LR\n\nD(user) --\u003e|POST request| A(HTTP server)\nA[HTTP server] --\u003e|push job| B[Valkey]\nB[Valkey] --\u003e|pop job| C[workers]\n\n```\n\n\nThe work done by this system is simple math: addition, subtraction, and multiplication. The endpoint path POSTed to (e.g., `http://127.0.0.1:3000/add`) determines the operation. The input values are taken from the request's JSON body.\n\nThis is a simple, quick, and dirty toy example for learning. Do not use this in production.\n\n\n## How is this run?\n\nSpawn local HTTP server, workers, and Valkey containers with `docker compose` with\n\n```bash\ndocker compose up\n```\n\nKeep this terminal session open to see workers containers respond requests. The containers will take a moment to spin up. The container image with the rust application is roughly 35 MB once it is compiled and built.\n\nOnce the containers are up and running, POST to the server from a separate terminal with `curl`, for example\n\n```bash\ncurl -i -H \"Content-Type: application/json\" \\\n  -X POST -d '{\"one\": 1, \"two\": 2}' \\\n  http://127.0.0.1:3000/add\n\ncurl -i -H \"Content-Type: application/json\" \\\n  -X POST -d '{\"one\": 5, \"two\": 3}' \\\n  http://127.0.0.1:3000/subtract\n\ncurl -i -H \"Content-Type: application/json\" \\\n  -X POST -d '{\"one\": 3, \"two\": 3}' \\\n  http://127.0.0.1:3000/multiply\n```\n\nSee the worker containers respond to activity in the original terminal session. They should respond within a minute.\n\n\n## Acknowledgments\n\nThis code is built from an example in chapter 18 of Maxwell Flitton (2023) \"Rust Web Programming\".\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrews%2Fredis_queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrews%2Fredis_queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrews%2Fredis_queue/lists"}