{"id":25720089,"url":"https://github.com/gregwhitaker/netifi-requeststream-example","last_synced_at":"2025-05-06T19:45:33.017Z","repository":{"id":82732579,"uuid":"220832752","full_name":"gregwhitaker/netifi-requeststream-example","owner":"gregwhitaker","description":"Example of using the request-stream interaction model with Netifi and RSocket","archived":false,"fork":false,"pushed_at":"2019-11-19T00:06:56.000Z","size":201,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T02:21:31.880Z","etag":null,"topics":["netifi","netifi-broker","netifi-java","reactive-programming","reactive-streams","rsocket","rsocket-java","rsocket-rpc"],"latest_commit_sha":null,"homepage":"https://www.netifi.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","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":"2019-11-10T18:36:16.000Z","updated_at":"2020-07-18T19:40:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"46def050-3f86-475f-9fb1-2ce45c873a79","html_url":"https://github.com/gregwhitaker/netifi-requeststream-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%2Fnetifi-requeststream-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fnetifi-requeststream-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fnetifi-requeststream-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fnetifi-requeststream-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregwhitaker","download_url":"https://codeload.github.com/gregwhitaker/netifi-requeststream-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252756656,"owners_count":21799529,"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":["netifi","netifi-broker","netifi-java","reactive-programming","reactive-streams","rsocket","rsocket-java","rsocket-rpc"],"created_at":"2025-02-25T17:36:32.226Z","updated_at":"2025-05-06T19:45:33.009Z","avatar_url":"https://github.com/gregwhitaker.png","language":"Java","readme":"# netifi-requeststream-example\nAn example of the request-stream interaction model and aggregating streams with [Netifi](https://www.netifi.com) and [RSocket](http://rsocket.io).\n\nThis example aggregates two different microservices, one that emits random letters, and one that emits random numbers into letter-number pairs.\n\n![project-structure-image](image-demo.png)\n\n## What is Netifi?\n[Netifi](https://www.netifi.com) is a platform for building cloud-native applications with the power of [RSocket](http://rsocket.io).\n\nNetifi provides service discovery, load-balancing, streaming, and back-pressure without deploying a whole host of infrastructure components and without polluting your code with circuit breakers and client-side load-balancing.\n\n## Project Structure\nThis example contains the following projects:\n\n* [client](client) - Client application that streams and combines data from the backend services.\n* [letter-service-idl](letter-service-idl) - Contract that defines the `letter-service` and `letter2-service` APIs.\n* [letter-service](letter-service) - Service that generates random letters.\n* [letter2-service](letter2-service) - Version 2 of the `letter-service` that adds capital letters.\n* [number-service-idl](number-service-idl) - Contract that defines the `number-service` API.\n* [number-service](number-service) - Service that generates random numbers. \n\n## Prerequisites\nThis example requires a running instance of the Netifi Broker.\n\nRun the following command to download the [Netifi Community Edition Broker](https://www.netifi.com/netifi-ce) as a Docker container:\n\n    docker pull netifi/broker:1.6.9\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\n### Request-Stream\nFollow the steps below to run the example that shows aggregating two request-streams:\n\n1. Run the following command to start a local Netifi Broker:\n\n        docker run -p 8001:8001 -p 8101:8101 -p 7001:7001 -p 6001:6001 \\\n        -e BROKER_SERVER_OPTS=\"'-Dnetifi.broker.admin.accessKey=8833333111127534' \\\n        '-Dnetifi.broker.admin.accessToken=Ih+hNsSdxLxAtHceTeEia2MGXSc=' \\\n        '-Dnetifi.authentication.0.accessKey=8833333111127534' \\\n        '-Dnetifi.authentication.0.accessToken=Ih+hNsSdxLxAtHceTeEia2MGXSc=' \\\n        '-Dnetifi.broker.ssl.disabled=true'\" \\\n        netifi/broker:1.6.9\n        \n2. In a new terminal, run the following command to start the `number-service`:\n\n        ./gradlew :number-service:run\n        \n3. In a new terminal, run the following command to start the `letter-service`:\n\n        ./gradlew :letter-service:run\n        \n4. In a new terminal, run the following command to start the client and stream from both the `letter-service` and `number-service`:\n\n        ./gradlew :client:runLetters\n        \n    If successful, you will see letters and numbers aggregated together every second similar to the following:\n\n        2019-11-10 14:46:57,494 INFO e.c.RunLettersStream [reactor-tcp-nio-4] a38\n        2019-11-10 14:46:58,496 INFO e.c.RunLettersStream [reactor-tcp-nio-4] o75\n        2019-11-10 14:46:59,501 INFO e.c.RunLettersStream [reactor-tcp-nio-4] x32\n        2019-11-10 14:47:00,504 INFO e.c.RunLettersStream [reactor-tcp-nio-4] m84\n        2019-11-10 14:47:01,508 INFO e.c.RunLettersStream [reactor-tcp-nio-4] u26\n        2019-11-10 14:47:02,515 INFO e.c.RunLettersStream [reactor-tcp-nio-4] f41\n        2019-11-10 14:47:03,519 INFO e.c.RunLettersStream [reactor-tcp-nio-4] z25\n\n### Request-Response\nFollow the steps below to run the example that shows aggregating request-response interactions where the letter data is load-balanced between `letter-service` and `letter2-service`:\n    \n1. In a new terminal, run the following command to start the `letter2-service`:\n\n        ./gradlew :letter2-service:run\n        \n2. In a new terminal, run the following command to start the client and load-balance between both `letter-service` instances and the `number-service`:\n\n        ./gradlew :client:runLetter\n        \n    If successful, you will see letters and numbers aggregated and note that the letters are both uppercase and lowercase similar to the following:\n\n        2019-11-10 14:51:31,564 INFO e.c.RunLettersStream [reactor-tcp-nio-4] N51\n        2019-11-10 14:51:31,564 INFO e.c.RunLettersStream [reactor-tcp-nio-4] I84\n        2019-11-10 14:51:31,565 INFO e.c.RunLettersStream [reactor-tcp-nio-4] X27\n        2019-11-10 14:51:31,566 INFO e.c.RunLettersStream [reactor-tcp-nio-4] P97\n        2019-11-10 14:51:31,566 INFO e.c.RunLettersStream [reactor-tcp-nio-4] D67\n        2019-11-10 14:51:31,567 INFO e.c.RunLettersStream [reactor-tcp-nio-4] l1\n        2019-11-10 14:51:31,567 INFO e.c.RunLettersStream [reactor-tcp-nio-4] A16\n        2019-11-10 14:51:31,567 INFO e.c.RunLettersStream [reactor-tcp-nio-4] l32\n        2019-11-10 14:51:31,567 INFO e.c.RunLettersStream [reactor-tcp-nio-4] s19\n        2019-11-10 14:51:31,568 INFO e.c.RunLettersStream [reactor-tcp-nio-4] Y89\n        2019-11-10 14:51:31,568 INFO e.c.RunLettersStream [reactor-tcp-nio-4] O3\n        2019-11-10 14:51:31,568 INFO e.c.RunLettersStream [reactor-tcp-nio-4] K88\n        2019-11-10 14:51:31,569 INFO e.c.RunLettersStream [reactor-tcp-nio-4] o94\n        2019-11-10 14:51:31,569 INFO e.c.RunLettersStream [reactor-tcp-nio-4] I17\n\n## Bugs and Feedback\nFor bugs, questions, and discussions please use the [Github Issues](https://github.com/gregwhitaker/netifi-requeststream-example/issues).\n\n## License\nCopyright 2019 Greg Whitaker\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Fnetifi-requeststream-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregwhitaker%2Fnetifi-requeststream-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Fnetifi-requeststream-example/lists"}