{"id":19839381,"url":"https://github.com/redislabs/redis-microservices-for-dummies","last_synced_at":"2025-08-22T19:05:25.560Z","repository":{"id":62137991,"uuid":"207647625","full_name":"RedisLabs/redis-microservices-for-dummies","owner":"RedisLabs","description":"Sample application described in Redis Microservices for Dummies","archived":false,"fork":false,"pushed_at":"2020-03-17T11:27:16.000Z","size":16,"stargazers_count":35,"open_issues_count":1,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-06T17:03:24.501Z","etag":null,"topics":["event-streaming","microservices","microservices-architecture","microservices-demo","python","redis"],"latest_commit_sha":null,"homepage":"https://redislabs.com","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/RedisLabs.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}},"created_at":"2019-09-10T19:36:51.000Z","updated_at":"2024-10-07T14:39:06.000Z","dependencies_parsed_at":"2022-10-27T04:00:35.262Z","dependency_job_id":null,"html_url":"https://github.com/RedisLabs/redis-microservices-for-dummies","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisLabs%2Fredis-microservices-for-dummies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisLabs%2Fredis-microservices-for-dummies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisLabs%2Fredis-microservices-for-dummies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisLabs%2Fredis-microservices-for-dummies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RedisLabs","download_url":"https://codeload.github.com/RedisLabs/redis-microservices-for-dummies/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251932513,"owners_count":21667157,"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":["event-streaming","microservices","microservices-architecture","microservices-demo","python","redis"],"created_at":"2024-11-12T12:22:07.379Z","updated_at":"2025-05-01T19:30:18.666Z","avatar_url":"https://github.com/RedisLabs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redis Microservices for Dummies\nThis repository contains the source code for the sample app discussed \nin the last chapter of the freely available [Redis Microservices for Dummies](https://redislabs.com/docs/redis-microservices-for-dummies/) book.\n\n## Overview\nThis is a sample application written in Python that models the core \nfunctionality of a library with an automated book request/return system.\n\nThe application is made up of two services that communicate via event streams and\nit's meant to exemplify how the microservices architecture influcences data modeling\nand communication. \n\n## Project Struture\n\n### `services/`\nContains the implementation of two services: `LendingService` and `ShelvingService`.\nMost of the implemented functionality is in `LendingService`. \n`ShelvingService` represents the main storage of the library, while `LendingService` \nrepresents the robotic arm tasked with fetching books from the library. We also assume\nthat `LendingService` has a small storage for frequently-requested books.\n\n\n### `lua/`\nContains the [Lua scripts](https://redis.io/commands/eval) that `LendingService` \nuses to perform some operations with transactional semantics (isolation, all-or-nothing).\n\n### `main.py`\nLoads the application. It's also possible to launch mutiple instances in parallel (i.e., supports horizontal scaling).\n```\nusage: main.py [-h] [-f] [-a ADDRESS] [--db DB] [--password PASSWORD] [--ssl]\n               unique_name\n\nLendingService sample implementation.\n\npositional arguments:\n  unique_name           unique name for this instance\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -f, --force           start even if there is a lock on this instance name\n  -a ADDRESS, --address ADDRESS\n                        redis address (or unix socket path) defaults to\n                        `redis://localhost:6379`\n  --db DB               redis database to use, defaults to 0\n  --password PASSWORD   redis password\n  --ssl                 use ssl\n  ```\n\n### `get_books.py`\nAllows you to request and return books. The result of each request will be logged by `main.py`.\n```\nusage: get_books.py [-h] [-a ADDRESS] [--db DB] [--password PASSWORD] [--ssl]\n                    {request,return} username book [book ...]\n\nCLI tool to get and return books.\n\npositional arguments:\n  {request,return}      action to perform, either `request` or `return`\n  username              name identifying the user\n  book                  names identifying a book\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -a ADDRESS, --address ADDRESS\n                        redis address (or unix socket path) defaults to\n                        `redis://localhost:6379`\n  --db DB               redis database to use, defaults to 0\n  --password PASSWORD   redis password\n  --ssl                 use ssl\n  ```\n\n## Usage\nFor convenience we assume that the library has a unique copy of every possible book. \nThis means that all requests for new books will always succeed.\nRequesting a book that is already being lent to another user will not succeed.\nUsers also have a limit of max 5 books they and be lent at any given time.\n\n\n### Usage example\n\nFirst make sure to install all the dependences:\n\n`pip install -r requirements.txt`\n\nThen launch the main process:\n\n`python main.py worker1`\n\nFinally, in another terminal:\n\n`python get_books.py request user1 alice-in-wonderland geb invisible-citites`\n\n`python get_books.py return user1 invisible-cities`\n\n`python get_books.py request user2 geb invisible-cities selfish-gene`\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredislabs%2Fredis-microservices-for-dummies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredislabs%2Fredis-microservices-for-dummies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredislabs%2Fredis-microservices-for-dummies/lists"}