{"id":25720035,"url":"https://github.com/gregwhitaker/rsocket-backpressure-example","last_synced_at":"2026-01-02T11:35:23.033Z","repository":{"id":52450324,"uuid":"237561299","full_name":"gregwhitaker/rsocket-backpressure-example","owner":"gregwhitaker","description":"Example of using Backpressure with RSocket","archived":false,"fork":false,"pushed_at":"2020-12-04T19:55:51.000Z","size":70,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-17T15:55:51.712Z","etag":null,"topics":["backpressure","flow-control","project-reactor","reactive","reactive-streams","rsocket","rsocket-java"],"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}},"created_at":"2020-02-01T04:25:00.000Z","updated_at":"2023-03-19T13:03:38.000Z","dependencies_parsed_at":"2022-09-09T05:51:35.353Z","dependency_job_id":null,"html_url":"https://github.com/gregwhitaker/rsocket-backpressure-example","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/gregwhitaker%2Frsocket-backpressure-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Frsocket-backpressure-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Frsocket-backpressure-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Frsocket-backpressure-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregwhitaker","download_url":"https://codeload.github.com/gregwhitaker/rsocket-backpressure-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240715304,"owners_count":19846014,"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":["backpressure","flow-control","project-reactor","reactive","reactive-streams","rsocket","rsocket-java"],"created_at":"2025-02-25T17:36:25.313Z","updated_at":"2026-01-02T11:35:23.008Z","avatar_url":"https://github.com/gregwhitaker.png","language":"Java","readme":"# rsocket-backpressure-example\n![Build](https://github.com/gregwhitaker/rsocket-backpressure-example/workflows/Build/badge.svg)\n\nAn example of backpressure between an [RSocket](http://rsocket.io) client and service.\n\nIn this example the `count-client` requests a stream of integers from the `count-service` and specifies that it can only handle\n`10` requests at a time.\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 `count-service`:\n\n        ./gradlew :count-service:run\n        \n    If the service has started successfully you will see the following in the terminal:\n    \n        \u003e Task :count-service:run\n        [main] INFO example.count.service.CountService - RSocket server started on port: 7000\n        \n2. In a new terminal, run the following command to start streaming integers with the `count-client`:\n\n        ./gradlew :count-client:run\n        \n    If successful, you will see in the terminal that it processes `10,000` integers:\n\n        [reactor-tcp-nio-1] INFO example.count.client.CountClient - Received: 9995\n        [reactor-tcp-nio-1] INFO example.count.client.CountClient - Received: 9996\n        [reactor-tcp-nio-1] INFO example.count.client.CountClient - Received: 9997\n        [reactor-tcp-nio-1] INFO example.count.client.CountClient - Received: 9998\n        [reactor-tcp-nio-1] INFO example.count.client.CountClient - Received: 9999\n        [reactor-tcp-nio-1] INFO example.count.client.CountClient - Received: 10000\n        [reactor-tcp-nio-1] INFO example.count.client.CountClient - Done\n        \n    In the `count-service` terminal, notice that it is receiving requests for `8` numbers at a time:\n    \n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9984\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9985\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9986\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Received Request For: 8\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9987\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9988\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9989\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9990\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9991\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9992\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9993\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9994\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Received Request For: 8\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9995\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9996\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9997\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9998\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 9999\n        [reactor-tcp-nio-2] INFO example.count.service.CountService - Sending: 10000\n        \n    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-backpressure-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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Frsocket-backpressure-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregwhitaker%2Frsocket-backpressure-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Frsocket-backpressure-example/lists"}