Skip to content

Commit

Permalink
Updates application.yaml file and shows how to configure the gRPC pro…
Browse files Browse the repository at this point in the history
…tocol in WebClient.

Signed-off-by: Santiago Pericas-Geertsen <[email protected]>
  • Loading branch information
spericas committed Oct 30, 2024
1 parent 10c9e81 commit 5c14944
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/webserver/grpc-random/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Helidon gRPC SE Randome Example
# Helidon gRPC SE Random Example


This example shows a simple _Random_ service written with the Helidon gRPC SE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void main(String[] args) {
Config.global(config);
Config serverConfig = config.get("server");

// start server and register gRPC routing and health check
// start server and register gRPC routing
WebServer.builder()
.config(serverConfig)
.addRouting(GrpcRouting.builder().service(new RandomService()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@

import io.helidon.common.configurable.Resource;
import io.helidon.common.tls.Tls;
import io.helidon.config.Config;
import io.helidon.examples.webserver.grpc.random.Random.ParamMessage;
import io.helidon.webclient.api.WebClient;
import io.helidon.webclient.grpc.GrpcClient;
import io.helidon.webclient.grpc.GrpcClientProtocolConfig;
import io.helidon.webserver.Router;
import io.helidon.webserver.WebServer;
import io.helidon.webserver.grpc.GrpcRouting;
Expand Down Expand Up @@ -65,9 +67,14 @@ private RandomServiceTest(WebServer server) {
.trustStore(true)
.keystore(Resource.create("client.p12"))))
.build();
Config config = Config.create();
GrpcClientProtocolConfig protocolConfig = GrpcClientProtocolConfig.builder()
.config(config.get("grpc-protocol-config"))
.build();
this.webClient = WebClient.builder()
.tls(clientTls)
.baseUri("https://localhost:" + server.port())
.addProtocolConfig(protocolConfig)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ server:
passphrase: "password"
resource:
resource-path: "server.p12"

grpc-protocol-config:
poll-wait-time: PT30S
abort-poll-time-expired: true
init-buffer-size: 10000
heartbeat-period: PT10S
6 changes: 0 additions & 6 deletions examples/webserver/grpc/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,3 @@ server:
observers:
health:
details: true

grpc-client:
poll-wait-time: PT30S
abort-poll-time-expired: true
init-buffer-size: 10000
heartbeat-period: PT10S

0 comments on commit 5c14944

Please sign in to comment.