https://github.com/albertoimpl/grpc-samples
https://github.com/albertoimpl/grpc-samples
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/albertoimpl/grpc-samples
- Owner: Albertoimpl
- Created: 2021-10-11T12:00:37.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-22T10:00:17.000Z (over 4 years ago)
- Last Synced: 2025-03-17T11:50:53.744Z (11 months ago)
- Language: Java
- Size: 252 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# grpc-samples
An end to end example with a `grpc-server` that produces a message, a `grpc-client` that consumes it and a `grpc-gateway` that routes the requests.
First we need to start the server that is going to be listing to requests:
```shell
./gradlew :grpc-server:bootRun
```
Then, we start the gateway that is going to re-route the gRPC requests:
```shell
./gradlew :grpc-gateway:bootRun
```
Finally, we can use the client that points to the gateway application:
```shell
./gradlew :grpc-client:bootRun
```
The gateway routes and filters can be modified in `grpc-gateway/src/main/resources/application.yaml`
At the moment there is just one route that will forward everything to the `grpc-server`:
```yaml
routes:
- id: grpc
uri: https://localhost:6565
predicates:
- Path=/**
filters:
- AddResponseHeader=X-Request-red, blue
```