From fb026932bcbffeb536403a5c1a60bc2877453cfe Mon Sep 17 00:00:00 2001 From: Julien Viet Date: Thu, 25 Jul 2024 18:49:53 +0200 Subject: [PATCH] Use the vertx protoc plugin2 instead of the legacy one --- grpc-examples/pom.xml | 4 ++-- .../example/grpc/consumer/ClientWithStub.java | 19 ++++++++------- .../example/grpc/consumer/ServerWithStub.java | 11 ++++----- .../grpc/conversation/ClientWithStub.java | 12 +++++----- .../grpc/conversation/ServerWithStub.java | 10 ++++---- .../example/grpc/empty/ClientWithStub.java | 6 ++--- .../grpc/helloworld/ClientWithStub.java | 6 ++--- .../grpc/helloworld/ServerWithStub.java | 11 ++++----- .../example/grpc/pingpong/ClientWithStub.java | 6 ++--- .../vertx/example/grpc/pingpong/Server.java | 24 ++++++++----------- .../example/grpc/pingpong/ServerWithStub.java | 15 ++++-------- .../example/grpc/producer/ClientWithStub.java | 4 ++-- .../example/grpc/producer/ServerWithStub.java | 10 ++++---- .../example/grpc/ssl/ClientWithStub.java | 4 ++-- .../example/grpc/ssl/ServerWithStub.java | 11 ++++----- 15 files changed, 67 insertions(+), 86 deletions(-) diff --git a/grpc-examples/pom.xml b/grpc-examples/pom.xml index 4b5913e1d..155edd6ae 100644 --- a/grpc-examples/pom.xml +++ b/grpc-examples/pom.xml @@ -106,9 +106,9 @@ vertx-grpc-protoc-plugin io.vertx - vertx-grpc-protoc-plugin + vertx-grpc-protoc-plugin2 ${project.version} - io.vertx.grpc.protoc.plugin.VertxGrpcGenerator + io.vertx.grpc.plugin.VertxGrpcGenerator diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/consumer/ClientWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/consumer/ClientWithStub.java index cf76b6eae..fb3021a70 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/consumer/ClientWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/consumer/ClientWithStub.java @@ -4,9 +4,8 @@ import io.vertx.core.Launcher; import io.vertx.core.net.SocketAddress; import io.vertx.example.grpc.Messages; -import io.vertx.example.grpc.VertxConsumerServiceGrpc; +import io.vertx.example.grpc.VertxConsumerServiceGrpcClient; import io.vertx.grpc.client.GrpcClient; -import io.vertx.grpc.client.GrpcClientChannel; import java.nio.charset.StandardCharsets; @@ -24,10 +23,9 @@ public void start() { // Create the channel GrpcClient client = GrpcClient.client(vertx); - GrpcClientChannel channel = new GrpcClientChannel(client, SocketAddress.inetSocketAddress(8080, "localhost")); // Get a stub to use for interacting with the remote service - VertxConsumerServiceGrpc.ConsumerServiceVertxStub stub = VertxConsumerServiceGrpc.newVertxStub(channel); + VertxConsumerServiceGrpcClient stub = new VertxConsumerServiceGrpcClient(client, SocketAddress.inetSocketAddress(8080, "localhost")); // Make a request Messages.StreamingOutputCallRequest request = Messages @@ -36,10 +34,13 @@ public void start() { .build(); // Call the remote service - stub.streamingOutputCall(request).handler(response -> { - System.out.println(new String(response.getPayload().toByteArray(), StandardCharsets.UTF_8)); - }).endHandler(v -> { - System.out.println("Response has ended."); - }); + stub.streamingOutputCall(request) + .onSuccess(response -> { + response.handler(msg -> { + System.out.println(new String(msg.getPayload().toByteArray(), StandardCharsets.UTF_8)); + }).endHandler(v -> { + System.out.println("Response has ended."); + }); + }); } } diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/consumer/ServerWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/consumer/ServerWithStub.java index 21b2c4e9b..4d4e17a40 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/consumer/ServerWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/consumer/ServerWithStub.java @@ -6,9 +6,8 @@ import io.vertx.core.streams.WriteStream; import io.vertx.example.grpc.Messages; import io.vertx.example.grpc.Messages.PayloadType; -import io.vertx.example.grpc.VertxConsumerServiceGrpc; +import io.vertx.example.grpc.VertxConsumerServiceGrpcServer; import io.vertx.grpc.server.GrpcServer; -import io.vertx.grpc.server.GrpcServiceBridge; import java.nio.charset.StandardCharsets; import java.util.concurrent.atomic.AtomicInteger; @@ -26,7 +25,7 @@ public static void main(String[] args) { public void start() { // The rpc service - VertxConsumerServiceGrpc.ConsumerServiceVertxImplBase service = new VertxConsumerServiceGrpc.ConsumerServiceVertxImplBase() { + VertxConsumerServiceGrpcServer.ConsumerServiceApi service = new VertxConsumerServiceGrpcServer.ConsumerServiceApi() { @Override public void streamingOutputCall(Messages.StreamingOutputCallRequest request, WriteStream response) { final AtomicInteger counter = new AtomicInteger(); @@ -43,9 +42,9 @@ public void streamingOutputCall(Messages.StreamingOutputCallRequest request, Wri // Create the server GrpcServer rpcServer = GrpcServer.server(vertx); - GrpcServiceBridge - .bridge(service) - .bind(rpcServer); + + // Bind the service + service.bind_streamingOutputCall(rpcServer); // start the server vertx.createHttpServer().requestHandler(rpcServer).listen(8080) diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/conversation/ClientWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/conversation/ClientWithStub.java index c22fb34e7..1f20b60ad 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/conversation/ClientWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/conversation/ClientWithStub.java @@ -4,9 +4,8 @@ import io.vertx.core.Launcher; import io.vertx.core.net.SocketAddress; import io.vertx.example.grpc.Messages; -import io.vertx.example.grpc.VertxConversationalServiceGrpc; +import io.vertx.example.grpc.VertxConversationalServiceGrpcClient; import io.vertx.grpc.client.GrpcClient; -import io.vertx.grpc.client.GrpcClientChannel; /* * @author Paulo Lopes @@ -22,10 +21,9 @@ public void start() { // Create the channel GrpcClient client = GrpcClient.client(vertx); - GrpcClientChannel channel = new GrpcClientChannel(client, SocketAddress.inetSocketAddress(8080, "localhost")); // Get a stub to use for interacting with the remote service - VertxConversationalServiceGrpc.ConversationalServiceVertxStub stub = VertxConversationalServiceGrpc.newVertxStub(channel); + VertxConversationalServiceGrpcClient stub = new VertxConversationalServiceGrpcClient(client, SocketAddress.inetSocketAddress(8080, "localhost")); // Call the remote service stub.fullDuplexCall(writeStream -> { @@ -34,8 +32,10 @@ public void start() { vertx.setTimer(500L, t -> { writeStream.write(Messages.StreamingOutputCallRequest.newBuilder().build()); }); - }).handler(req -> { - System.out.println("Client: received response"); + }).onSuccess(resp -> { + resp.handler(msg -> { + System.out.println("Client: received response"); + }); }); } } diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/conversation/ServerWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/conversation/ServerWithStub.java index e18a126bb..e176c205e 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/conversation/ServerWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/conversation/ServerWithStub.java @@ -6,7 +6,7 @@ import io.vertx.core.streams.ReadStream; import io.vertx.core.streams.WriteStream; import io.vertx.example.grpc.Messages; -import io.vertx.example.grpc.VertxConversationalServiceGrpc; +import io.vertx.example.grpc.VertxConversationalServiceGrpcServer; import io.vertx.grpc.server.GrpcServer; import io.vertx.grpc.server.GrpcServiceBridge; @@ -23,7 +23,7 @@ public static void main(String[] args) { public void start() { // The rpc service - VertxConversationalServiceGrpc.ConversationalServiceVertxImplBase service = new VertxConversationalServiceGrpc.ConversationalServiceVertxImplBase() { + VertxConversationalServiceGrpcServer.ConversationalServiceApi service = new VertxConversationalServiceGrpcServer.ConversationalServiceApi() { @Override public void fullDuplexCall(ReadStream request, WriteStream response) { request @@ -38,9 +38,9 @@ public void fullDuplexCall(ReadStream reque // Create the server GrpcServer rpcServer = GrpcServer.server(vertx); - GrpcServiceBridge - .bridge(service) - .bind(rpcServer); + + // Bind the service + service.bind_fullDuplexCall(rpcServer); // start the server vertx.createHttpServer().requestHandler(rpcServer).listen(8080) diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/empty/ClientWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/empty/ClientWithStub.java index 0ce6a987c..09fac3d67 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/empty/ClientWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/empty/ClientWithStub.java @@ -4,9 +4,8 @@ import io.vertx.core.Launcher; import io.vertx.core.net.SocketAddress; import io.vertx.example.grpc.EmptyProtos; -import io.vertx.example.grpc.VertxEmptyPingPongServiceGrpc; +import io.vertx.example.grpc.VertxEmptyPingPongServiceGrpcClient; import io.vertx.grpc.client.GrpcClient; -import io.vertx.grpc.client.GrpcClientChannel; /* * @author Paulo Lopes @@ -22,10 +21,9 @@ public void start() { // Create the channel GrpcClient client = GrpcClient.client(vertx); - GrpcClientChannel channel = new GrpcClientChannel(client, SocketAddress.inetSocketAddress(8080, "localhost")); // Get a stub to use for interacting with the remote service - VertxEmptyPingPongServiceGrpc.EmptyPingPongServiceVertxStub stub = VertxEmptyPingPongServiceGrpc.newVertxStub(channel); + VertxEmptyPingPongServiceGrpcClient stub = new VertxEmptyPingPongServiceGrpcClient(client, SocketAddress.inetSocketAddress(8080, "localhost")); // Make a request EmptyProtos.Empty request = EmptyProtos.Empty.newBuilder().build(); diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/helloworld/ClientWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/helloworld/ClientWithStub.java index 8d0382d5f..7502284c4 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/helloworld/ClientWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/helloworld/ClientWithStub.java @@ -1,12 +1,11 @@ package io.vertx.example.grpc.helloworld; import io.grpc.examples.helloworld.HelloRequest; -import io.grpc.examples.helloworld.VertxGreeterGrpc; +import io.grpc.examples.helloworld.VertxGreeterGrpcClient; import io.vertx.core.AbstractVerticle; import io.vertx.core.Launcher; import io.vertx.core.net.SocketAddress; import io.vertx.grpc.client.GrpcClient; -import io.vertx.grpc.client.GrpcClientChannel; /** * @author Julien Viet @@ -20,8 +19,7 @@ public static void main(String[] args) { @Override public void start() { GrpcClient client = GrpcClient.client(vertx); - GrpcClientChannel channel = new GrpcClientChannel(client, SocketAddress.inetSocketAddress(8080, "localhost")); - VertxGreeterGrpc.GreeterVertxStub stub = VertxGreeterGrpc.newVertxStub(channel); + VertxGreeterGrpcClient stub = new VertxGreeterGrpcClient(client, SocketAddress.inetSocketAddress(8080, "localhost")); HelloRequest request = HelloRequest.newBuilder().setName("Julien").build(); stub.sayHello(request).onComplete(asyncResponse -> { if (asyncResponse.succeeded()) { diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/helloworld/ServerWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/helloworld/ServerWithStub.java index c03522423..9cece7781 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/helloworld/ServerWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/helloworld/ServerWithStub.java @@ -2,12 +2,11 @@ import io.grpc.examples.helloworld.HelloReply; import io.grpc.examples.helloworld.HelloRequest; -import io.grpc.examples.helloworld.VertxGreeterGrpc; +import io.grpc.examples.helloworld.VertxGreeterGrpcServer; import io.vertx.core.AbstractVerticle; import io.vertx.core.Future; import io.vertx.core.Launcher; import io.vertx.grpc.server.GrpcServer; -import io.vertx.grpc.server.GrpcServiceBridge; /** * @author Julien Viet @@ -20,7 +19,7 @@ public static void main(String[] args) { @Override public void start() { - VertxGreeterGrpc.GreeterVertxImplBase service = new VertxGreeterGrpc.GreeterVertxImplBase() { + VertxGreeterGrpcServer.GreeterApi service = new VertxGreeterGrpcServer.GreeterApi() { @Override public Future sayHello(HelloRequest request) { System.out.println("Hello " + request.getName()); @@ -30,9 +29,9 @@ public Future sayHello(HelloRequest request) { // Create the server GrpcServer rpcServer = GrpcServer.server(vertx); - GrpcServiceBridge - .bridge(service) - .bind(rpcServer); + + // Bind the service + service.bind_sayHello(rpcServer); // start the server vertx.createHttpServer().requestHandler(rpcServer).listen(8080) diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/ClientWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/ClientWithStub.java index b93079410..bb9692dc8 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/ClientWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/ClientWithStub.java @@ -4,9 +4,8 @@ import io.vertx.core.Launcher; import io.vertx.core.net.SocketAddress; import io.vertx.example.grpc.Messages; -import io.vertx.example.grpc.VertxPingPongServiceGrpc; +import io.vertx.example.grpc.VertxPingPongServiceGrpcClient; import io.vertx.grpc.client.GrpcClient; -import io.vertx.grpc.client.GrpcClientChannel; /* * @author Paulo Lopes @@ -22,10 +21,9 @@ public void start() { // Create the channel GrpcClient client = GrpcClient.client(vertx); - GrpcClientChannel channel = new GrpcClientChannel(client, SocketAddress.inetSocketAddress(8080, "localhost")); // Get a stub to use for interacting with the remote service - VertxPingPongServiceGrpc.PingPongServiceVertxStub stub = VertxPingPongServiceGrpc.newVertxStub(channel); + VertxPingPongServiceGrpcClient stub = new VertxPingPongServiceGrpcClient(client, SocketAddress.inetSocketAddress(8080, "localhost")); // Make a request Messages.SimpleRequest request = Messages.SimpleRequest.newBuilder().setFillUsername(true).build(); diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/Server.java b/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/Server.java index 40dcf0701..14f14a1a1 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/Server.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/Server.java @@ -1,12 +1,10 @@ package io.vertx.example.grpc.pingpong; import io.vertx.core.AbstractVerticle; -import io.vertx.core.Future; import io.vertx.core.Launcher; import io.vertx.example.grpc.Messages; -import io.vertx.example.grpc.VertxPingPongServiceGrpc; +import io.vertx.example.grpc.PingPongServiceGrpc; import io.vertx.grpc.server.GrpcServer; -import io.vertx.grpc.server.GrpcServiceBridge; /* * @author Paulo Lopes @@ -20,19 +18,17 @@ public static void main(String[] args) { @Override public void start() { - // The rpc service - VertxPingPongServiceGrpc.PingPongServiceVertxImplBase service = new VertxPingPongServiceGrpc.PingPongServiceVertxImplBase() { - @Override - public Future unaryCall(Messages.SimpleRequest request) { - return Future.succeededFuture(Messages.SimpleResponse.newBuilder().setUsername("Paulo").build()); - } - }; - // Create the server GrpcServer rpcServer = GrpcServer.server(vertx); - GrpcServiceBridge - .bridge(service) - .bind(rpcServer); + + // + rpcServer.callHandler(PingPongServiceGrpc.getUnaryCallMethod(), request -> { + request + .last() + .onSuccess(msg -> { + request.response().end(Messages.SimpleResponse.newBuilder().setUsername("Paulo").build()); + }); + }); // start the server vertx.createHttpServer().requestHandler(rpcServer).listen(8080) diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/ServerWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/ServerWithStub.java index 5ead529f4..8751a410e 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/ServerWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/pingpong/ServerWithStub.java @@ -4,8 +4,7 @@ import io.vertx.core.Future; import io.vertx.core.Launcher; import io.vertx.example.grpc.Messages; -import io.vertx.example.grpc.PingPongServiceGrpc; -import io.vertx.example.grpc.VertxPingPongServiceGrpc; +import io.vertx.example.grpc.VertxPingPongServiceGrpcServer; import io.vertx.grpc.server.GrpcServer; /* @@ -21,7 +20,7 @@ public static void main(String[] args) { public void start() { // The rpc service - VertxPingPongServiceGrpc.PingPongServiceVertxImplBase service = new VertxPingPongServiceGrpc.PingPongServiceVertxImplBase() { + VertxPingPongServiceGrpcServer.PingPongServiceApi service = new VertxPingPongServiceGrpcServer.PingPongServiceApi() { @Override public Future unaryCall(Messages.SimpleRequest request) { return Future.succeededFuture(Messages.SimpleResponse.newBuilder().setUsername("Paulo").build()); @@ -31,14 +30,8 @@ public Future unaryCall(Messages.SimpleRequest request) // Create the server GrpcServer rpcServer = GrpcServer.server(vertx); - // The rpc service - rpcServer.callHandler(PingPongServiceGrpc.getUnaryCallMethod(), request -> { - request - .last() - .onSuccess(msg -> { - request.response().end(Messages.SimpleResponse.newBuilder().setUsername("Paulo").build()); - }); - }); + // Bind the service + service.bind_unaryCall(rpcServer); // start the server vertx.createHttpServer().requestHandler(rpcServer).listen(8080) diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/producer/ClientWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/producer/ClientWithStub.java index 3757e4bc4..23e2bbf92 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/producer/ClientWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/producer/ClientWithStub.java @@ -4,7 +4,7 @@ import io.vertx.core.Launcher; import io.vertx.core.net.SocketAddress; import io.vertx.example.grpc.Messages; -import io.vertx.example.grpc.VertxProducerServiceGrpc; +import io.vertx.example.grpc.VertxProducerServiceGrpcClient; import io.vertx.grpc.client.GrpcClient; import io.vertx.grpc.client.GrpcClientChannel; @@ -25,7 +25,7 @@ public void start() { GrpcClientChannel channel = new GrpcClientChannel(client, SocketAddress.inetSocketAddress(8080, "localhost")); // Get a stub to use for interacting with the remote service - VertxProducerServiceGrpc.ProducerServiceVertxStub stub = VertxProducerServiceGrpc.newVertxStub(channel); + VertxProducerServiceGrpcClient stub = new VertxProducerServiceGrpcClient(client, SocketAddress.inetSocketAddress(8080, "localhost")); // Call the remote service stub.streamingInputCall(writeStream -> { diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/producer/ServerWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/producer/ServerWithStub.java index c13674a40..7c5e8a828 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/producer/ServerWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/producer/ServerWithStub.java @@ -6,7 +6,7 @@ import io.vertx.core.Promise; import io.vertx.core.streams.ReadStream; import io.vertx.example.grpc.Messages; -import io.vertx.example.grpc.VertxProducerServiceGrpc; +import io.vertx.example.grpc.VertxProducerServiceGrpcServer; import io.vertx.grpc.server.GrpcServer; import io.vertx.grpc.server.GrpcServiceBridge; @@ -23,7 +23,7 @@ public static void main(String[] args) { public void start() { // The rpc service - VertxProducerServiceGrpc.ProducerServiceVertxImplBase service = new VertxProducerServiceGrpc.ProducerServiceVertxImplBase() { + VertxProducerServiceGrpcServer.ProducerServiceApi service = new VertxProducerServiceGrpcServer.ProducerServiceApi() { @Override public Future streamingInputCall(ReadStream request) { Promise promise = Promise.promise(); @@ -39,9 +39,9 @@ public Future streamingInputCall(ReadStream // Create the server GrpcServer rpcServer = GrpcServer.server(vertx); - GrpcServiceBridge - .bridge(service) - .bind(rpcServer); + + // Bind the service + service.bind_streamingInputCall(rpcServer); // start the server vertx.createHttpServer().requestHandler(rpcServer).listen(8080) diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/ssl/ClientWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/ssl/ClientWithStub.java index 01b1a869c..fc5c6f881 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/ssl/ClientWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/ssl/ClientWithStub.java @@ -1,7 +1,7 @@ package io.vertx.example.grpc.ssl; import io.grpc.examples.helloworld.HelloRequest; -import io.grpc.examples.helloworld.VertxGreeterGrpc; +import io.grpc.examples.helloworld.VertxGreeterGrpcClient; import io.vertx.core.AbstractVerticle; import io.vertx.core.Launcher; import io.vertx.core.http.HttpClientOptions; @@ -30,7 +30,7 @@ public void start() { .setPassword("wibble")); GrpcClient client = GrpcClient.client(vertx, options); GrpcClientChannel channel = new GrpcClientChannel(client, SocketAddress.inetSocketAddress(8080, "localhost")); - VertxGreeterGrpc.GreeterVertxStub stub = VertxGreeterGrpc.newVertxStub(channel); + VertxGreeterGrpcClient stub = new VertxGreeterGrpcClient(client, SocketAddress.inetSocketAddress(8080, "localhost")); HelloRequest request = HelloRequest.newBuilder().setName("Julien").build(); stub.sayHello(request).onComplete(asyncResponse -> { if (asyncResponse.succeeded()) { diff --git a/grpc-examples/src/main/java/io/vertx/example/grpc/ssl/ServerWithStub.java b/grpc-examples/src/main/java/io/vertx/example/grpc/ssl/ServerWithStub.java index 64ea772a7..e70f18678 100644 --- a/grpc-examples/src/main/java/io/vertx/example/grpc/ssl/ServerWithStub.java +++ b/grpc-examples/src/main/java/io/vertx/example/grpc/ssl/ServerWithStub.java @@ -2,14 +2,13 @@ import io.grpc.examples.helloworld.HelloReply; import io.grpc.examples.helloworld.HelloRequest; -import io.grpc.examples.helloworld.VertxGreeterGrpc; +import io.grpc.examples.helloworld.VertxGreeterGrpcServer; import io.vertx.core.AbstractVerticle; import io.vertx.core.Future; import io.vertx.core.Launcher; import io.vertx.core.http.HttpServerOptions; import io.vertx.core.net.JksOptions; import io.vertx.grpc.server.GrpcServer; -import io.vertx.grpc.server.GrpcServiceBridge; /** * @author Julien Viet @@ -22,7 +21,7 @@ public static void main(String[] args) { @Override public void start() { - VertxGreeterGrpc.GreeterVertxImplBase service = new VertxGreeterGrpc.GreeterVertxImplBase() { + VertxGreeterGrpcServer.GreeterApi service = new VertxGreeterGrpcServer.GreeterApi() { @Override public Future sayHello(HelloRequest request) { System.out.println("Hello " + request.getName()); @@ -32,9 +31,9 @@ public Future sayHello(HelloRequest request) { // Create the server GrpcServer rpcServer = GrpcServer.server(vertx); - GrpcServiceBridge - .bridge(service) - .bind(rpcServer); + + // Bind the service + service.bind_sayHello(rpcServer); // start the server HttpServerOptions options = new HttpServerOptions()