{"id":25720030,"url":"https://github.com/gregwhitaker/rsocket-composingbackpressure-example","last_synced_at":"2026-06-16T15:31:30.715Z","repository":{"id":82732629,"uuid":"237856917","full_name":"gregwhitaker/rsocket-composingbackpressure-example","owner":"gregwhitaker","description":"Example of composing backpressure across microservices with RSocket","archived":false,"fork":false,"pushed_at":"2020-12-04T19:53:55.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T17:41:26.822Z","etag":null,"topics":["backpressure","reactive","reactive-programming","reactive-streams","rsocket","rsocket-java","rsocket-loadbalancing"],"latest_commit_sha":null,"homepage":"http://rsocket.io","language":"Java","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/gregwhitaker.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":"2020-02-03T00:18:23.000Z","updated_at":"2020-12-04T19:53:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"a90a149f-70a1-41ef-adb2-22e0ade10621","html_url":"https://github.com/gregwhitaker/rsocket-composingbackpressure-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gregwhitaker/rsocket-composingbackpressure-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Frsocket-composingbackpressure-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Frsocket-composingbackpressure-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Frsocket-composingbackpressure-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Frsocket-composingbackpressure-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregwhitaker","download_url":"https://codeload.github.com/gregwhitaker/rsocket-composingbackpressure-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Frsocket-composingbackpressure-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34412785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["backpressure","reactive","reactive-programming","reactive-streams","rsocket","rsocket-java","rsocket-loadbalancing"],"created_at":"2025-02-25T17:36:25.093Z","updated_at":"2026-06-16T15:31:30.710Z","avatar_url":"https://github.com/gregwhitaker.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rsocket-composingbackpressure-example\n![Build](https://github.com/gregwhitaker/rsocket-composingbackpressure-example/workflows/Build/badge.svg)\n\nAn example showing how backpressure composes between multiple microservices with [RSocket](http://rsocket.io).\n\nIn this example the `client` requests a stream from the `letter-service` and explicitly states that it can handle `10` items at a time.\nThe letter-service then requests a stream of numbers from the `number-service` and propagates the demand (backpressure) from the client. The letter-service\ncombines the numbers with a random letter and streams them to the client.\n\n## Building the Example\nRun the following command to build the example:\n\n    ./gradlew clean build\n    \n## Running the Example\nFollow the steps below to run the example:\n\n1. Run the following command to start the `number-service`:\n\n        ./gradlew :number-service:run\n        \n    If the service has started successfully, you will see the following in the terminal:\n    \n        \u003e Task :number-service:run\n        [main] INFO example.number.service.NumberService - RSocket server started on port: 7002\n        \n2. In a new terminal, run the following command to start the `letter-service`:\n\n        ./gradlew :letter-service:run\n        \n    If the service has started successfully, you will see the following in the terminal:\n    \n        \u003e Task :letter-service:run\n        [main] INFO example.letter.service.LetterService - RSocket server started on port: 7001\n        \n3. In a new terminal, run the following command to start streaming data with the `client`:\n\n        ./gradlew :client:run\n        \n    If successful, you will see the client receives 10,000 letter and number pairs in the terminal:\n    \n        [reactor-tcp-nio-1] INFO example.client.Client - Received: f9996\n        [reactor-tcp-nio-1] INFO example.client.Client - Received: R9997\n        [reactor-tcp-nio-1] INFO example.client.Client - Received: t9998\n        [reactor-tcp-nio-1] INFO example.client.Client - Received: O9999\n        [reactor-tcp-nio-1] INFO example.client.Client - Received: G10000\n        [reactor-tcp-nio-1] INFO example.client.Client - Done\n        \n    Notice in the `letter-service` terminal that the client is requesting `8` combinations at a time:\n    \n        [reactor-tcp-nio-1] INFO example.letter.service.LetterService - Sending: t9993\n        [reactor-tcp-nio-1] INFO example.letter.service.LetterService - Sending: n9994\n        [reactor-tcp-nio-3] INFO example.letter.service.LetterService - Received Request For: 8\n        [reactor-tcp-nio-1] INFO example.letter.service.LetterService - Sending: H9995\n        [reactor-tcp-nio-1] INFO example.letter.service.LetterService - Sending: f9996\n        [reactor-tcp-nio-1] INFO example.letter.service.LetterService - Sending: R9997\n        [reactor-tcp-nio-1] INFO example.letter.service.LetterService - Sending: t9998\n        [reactor-tcp-nio-1] INFO example.letter.service.LetterService - Sending: O9999\n        [reactor-tcp-nio-1] INFO example.letter.service.LetterService - Sending: G10000\n        \n    Notice in the `number-service` terminal the client's demand of `8` combinations is propagated to the number service:\n    \n        [reactor-tcp-nio-2] INFO example.number.service.NumberService - Sending: 9993\n        [reactor-tcp-nio-2] INFO example.number.service.NumberService - Sending: 9994\n        [reactor-tcp-nio-2] INFO example.number.service.NumberService - Received Request For: 8\n        [reactor-tcp-nio-2] INFO example.number.service.NumberService - Sending: 9995\n        [reactor-tcp-nio-2] INFO example.number.service.NumberService - Sending: 9996\n        [reactor-tcp-nio-2] INFO example.number.service.NumberService - Sending: 9997\n        [reactor-tcp-nio-2] INFO example.number.service.NumberService - Sending: 9998\n        [reactor-tcp-nio-2] INFO example.number.service.NumberService - Sending: 9999\n        [reactor-tcp-nio-2] INFO example.number.service.NumberService - Sending: 10000\n        \n    **Note:** The `8` items comes from the `limitRate(10)` on the client. The limitRate algorithm proactively fills the buffer when it is 75% exhausted. That is why you are seeing it request 8 instead of 10.\n        \n## Bugs and Feedback\nFor bugs, questions, and discussions please use the [Github Issues](https://github.com/gregwhitaker/rsocket-composingbackpressure-example/issues).\n\n## License\nMIT License\n\nCopyright (c) 2020 Greg Whitaker\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Frsocket-composingbackpressure-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregwhitaker%2Frsocket-composingbackpressure-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Frsocket-composingbackpressure-example/lists"}