diff --git a/armeria-example/armeria-grpc-client/pom.xml b/armeria-example/armeria-grpc-client/pom.xml new file mode 100644 index 0000000..4c0ba93 --- /dev/null +++ b/armeria-example/armeria-grpc-client/pom.xml @@ -0,0 +1,42 @@ + + + + armeria-example + com.example.armeria + 1.0-SNAPSHOT + ../pom.xml + + 4.0.0 + + armeria-grpc-client + + + + ${project.groupId} + armeria-grpc-server + ${project.version} + + + com.linecorp.armeria + armeria-grpc + 0.99.2 + + + + + + + kr.motd.maven + os-maven-plugin + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + + + + diff --git a/armeria-example/armeria-grpc-client/src/main/java/com/exmaple/grpc/armeria/ArmeriaGrpcClient.java b/armeria-example/armeria-grpc-client/src/main/java/com/exmaple/grpc/armeria/ArmeriaGrpcClient.java new file mode 100644 index 0000000..02c9518 --- /dev/null +++ b/armeria-example/armeria-grpc-client/src/main/java/com/exmaple/grpc/armeria/ArmeriaGrpcClient.java @@ -0,0 +1,81 @@ +package com.exmaple.grpc.armeria; + + +import java.util.concurrent.CountDownLatch; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.example.grpc.armeria.Hello.HelloReply; +import com.example.grpc.armeria.Hello.HelloRequest; +import com.example.grpc.armeria.HelloServiceGrpc.HelloServiceBlockingStub; +import com.example.grpc.armeria.HelloServiceGrpc.HelloServiceFutureStub; +import com.example.grpc.armeria.HelloServiceGrpc.HelloServiceStub; +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.MoreExecutors; + +import com.linecorp.armeria.client.Clients; + +import io.grpc.stub.StreamObserver; + +public final class ArmeriaGrpcClient { + + private static final Logger logger = LoggerFactory.getLogger(ArmeriaGrpcClient.class); + + public static void main(String[] args) throws InterruptedException { + final String uri = "gproto+http://127.0.0.1:8080/"; + + // Creates blocking gRPC client + final HelloServiceBlockingStub blockingStub = Clients.newClient(uri, HelloServiceBlockingStub.class); + final String blockingResponse = blockingStub.hello(HelloRequest.newBuilder().setName("Armeria").build()) + .getMessage(); + logger.info("Reply of 'hello': {}", blockingResponse); + + // Creates non-blocking gRPC client with Guava ListenableFuture + final HelloServiceFutureStub futureStub = Clients.newClient(uri, HelloServiceFutureStub.class); + final ListenableFuture future = + futureStub.lazyHello(HelloRequest.newBuilder().setName("Armeria").build()); + + final CountDownLatch countDownLatch1 = new CountDownLatch(1); + Futures.addCallback(future, new FutureCallback() { + @Override + public void onSuccess(HelloReply result) { + logger.info("Reply of 'lazyHello': {}", result.getMessage()); + countDownLatch1.countDown(); + } + + @Override + public void onFailure(Throwable t) { + throw new Error(t); // Should never reach here. + } + }, MoreExecutors.directExecutor()); + + countDownLatch1.await(); + + // Creates non-blocking gRPC client with StreamObserver + final HelloServiceStub helloService = Clients.newClient(uri, HelloServiceStub.class); + final CountDownLatch countDownLatch2 = new CountDownLatch(1); + helloService.lotsOfReplies( + HelloRequest.newBuilder().setName("Armeria").build(), + new StreamObserver() { + + @Override + public void onNext(HelloReply value) { + logger.info("Reply of 'lotsOfReplies: {}", value.getMessage()); + } + + @Override + public void onError(Throwable t) { + throw new Error(t); // Should never reach here. + } + + @Override + public void onCompleted() { + countDownLatch2.countDown(); + } + }); + countDownLatch2.await(); + } +} diff --git a/armeria-example/armeria-grpc-server/pom.xml b/armeria-example/armeria-grpc-server/pom.xml new file mode 100644 index 0000000..adcf628 --- /dev/null +++ b/armeria-example/armeria-grpc-server/pom.xml @@ -0,0 +1,49 @@ + + + + armeria-example + com.example.armeria + 1.0-SNAPSHOT + ../pom.xml + + 4.0.0 + + armeria-grpc-server + + + + com.linecorp.armeria + armeria-grpc + 0.99.2 + + + io.projectreactor + reactor-core + 3.3.4.RELEASE + + + org.slf4j + slf4j-simple + 1.7.29 + runtime + + + + + + + + kr.motd.maven + os-maven-plugin + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + + + + diff --git a/armeria-example/armeria-grpc-server/src/main/java/com/example/grpc/armeria/ArmeriaGrpcServer.java b/armeria-example/armeria-grpc-server/src/main/java/com/example/grpc/armeria/ArmeriaGrpcServer.java new file mode 100644 index 0000000..1b40661 --- /dev/null +++ b/armeria-example/armeria-grpc-server/src/main/java/com/example/grpc/armeria/ArmeriaGrpcServer.java @@ -0,0 +1,75 @@ +package com.example.grpc.armeria; + +import java.net.InetSocketAddress; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.example.grpc.armeria.Hello.HelloRequest; + +import com.linecorp.armeria.common.grpc.GrpcSerializationFormats; +import com.linecorp.armeria.server.HttpServiceWithRoutes; +import com.linecorp.armeria.server.Server; +import com.linecorp.armeria.server.docs.DocService; +import com.linecorp.armeria.server.docs.DocServiceFilter; +import com.linecorp.armeria.server.grpc.GrpcService; + +import io.grpc.protobuf.services.ProtoReflectionService; +import io.grpc.reflection.v1alpha.ServerReflectionGrpc; + +public final class ArmeriaGrpcServer { + + private static final Logger logger = LoggerFactory.getLogger(ArmeriaGrpcServer.class); + + public static void main(String[] args) throws Exception { + final Server server = newServer(8080, 8443); + + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + server.stop().join(); + logger.info("Server has been stopped."); + })); + + server.start().join(); + final InetSocketAddress localAddress = server.activePort().localAddress(); + final boolean isLocalAddress = localAddress.getAddress().isAnyLocalAddress() || + localAddress.getAddress().isLoopbackAddress(); + logger.info("Server has been started. Serving DocService at http://{}:{}/docs", + isLocalAddress ? "127.0.0.1" : localAddress.getHostString(), localAddress.getPort()); + } + + static Server newServer(int httpPort, int httpsPort) throws Exception { + final HelloRequest exampleRequest = HelloRequest.newBuilder().setName("Armeria").build(); + final HttpServiceWithRoutes grpcService = + GrpcService.builder() + .addService(new HelloServiceImpl()) + // See https://github.com/grpc/grpc-java/blob/master/documentation/server-reflection-tutorial.md + .addService(ProtoReflectionService.newInstance()) + .supportedSerializationFormats(GrpcSerializationFormats.values()) + .enableUnframedRequests(true) + // You can set useBlockingTaskExecutor(true) in order to execute all gRPC + // methods in the blockingTaskExecutor thread pool. + // .useBlockingTaskExecutor(true) + .build(); + + return Server.builder() + .http(httpPort) + .https(httpsPort) + .tlsSelfSigned() + .service(grpcService) + // You can access the documentation service at http://127.0.0.1:8080/docs. + // See https://line.github.io/armeria/server-docservice.html for more information. + .serviceUnder("/docs", DocService.builder() + .exampleRequestForMethod(HelloServiceGrpc.SERVICE_NAME, + "Hello", exampleRequest) + .exampleRequestForMethod(HelloServiceGrpc.SERVICE_NAME, + "LazyHello", exampleRequest) + .exampleRequestForMethod(HelloServiceGrpc.SERVICE_NAME, + "BlockingHello", exampleRequest) + .exclude(DocServiceFilter.ofServiceName( + ServerReflectionGrpc.SERVICE_NAME)) + .build()) + .build(); + } + + private ArmeriaGrpcServer() {} +} diff --git a/armeria-example/armeria-grpc-server/src/main/java/com/example/grpc/armeria/HelloServiceImpl.java b/armeria-example/armeria-grpc-server/src/main/java/com/example/grpc/armeria/HelloServiceImpl.java new file mode 100644 index 0000000..d180484 --- /dev/null +++ b/armeria-example/armeria-grpc-server/src/main/java/com/example/grpc/armeria/HelloServiceImpl.java @@ -0,0 +1,156 @@ +package com.example.grpc.armeria; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.concurrent.TimeUnit; + +import com.linecorp.armeria.server.ServiceRequestContext; + +import com.example.grpc.armeria.Hello.HelloReply; +import com.example.grpc.armeria.Hello.HelloRequest; +import com.example.grpc.armeria.HelloServiceGrpc.HelloServiceImplBase; +import io.grpc.stub.StreamObserver; +import reactor.core.publisher.Flux; +import reactor.core.scheduler.Schedulers; + +public class HelloServiceImpl extends HelloServiceImplBase { + + /** + * Sends a {@link HelloReply} immediately when receiving a request. + */ + @Override + public void hello(HelloRequest request, StreamObserver responseObserver) { + responseObserver.onNext(buildReply(toMessage(request.getName()))); + responseObserver.onCompleted(); + } + + /** + * Sends a {@link HelloReply} 3 seconds after receiving a request. + */ + @Override + public void lazyHello(HelloRequest request, StreamObserver responseObserver) { + // You can use the event loop for scheduling a task. + ServiceRequestContext.current().contextAwareEventLoop().schedule(() -> { + responseObserver.onNext(buildReply(toMessage(request.getName()))); + responseObserver.onCompleted(); + }, 3, TimeUnit.SECONDS); + } + + /** + * Sends a {@link HelloReply} using {@code blockingTaskExecutor}. + * + * @see Blocking + * service implementation + */ + @Override + public void blockingHello(HelloRequest request, StreamObserver responseObserver) { + // Unlike upstream gRPC-Java, Armeria does not run service logic in a separate thread pool by default. + // Therefore, this method will run in the event loop, which means that you can suffer the performance + // degradation if you call a blocking API in this method. In this case, you have the following options: + // + // 1. Call a blocking API in the blockingTaskExecutor provided by Armeria. + // 2. Set GrpcServiceBuilder.useBlockingTaskExecutor(true) when building your GrpcService. + // 3. Call a blocking API in the separate thread pool you manage. + // + // In this example, we chose the option 1: + ServiceRequestContext.current().blockingTaskExecutor().submit(() -> { + try { + // Simulate a blocking API call. + Thread.sleep(3000); + } catch (Exception ignored) { + // Do nothing. + } + responseObserver.onNext(buildReply(toMessage(request.getName()))); + responseObserver.onCompleted(); + }); + } + + /** + * Sends 5 {@link HelloReply} responses when receiving a request. + * + * @see #lazyHello(HelloRequest, StreamObserver) + */ + @Override + public void lotsOfReplies(HelloRequest request, StreamObserver responseObserver) { + // You can also write this code without Reactor like 'lazyHello' example. + Flux.interval(Duration.ofSeconds(1)) + .take(5) + .map(index -> "Hello, " + request.getName() + "! (sequence: " + (index + 1) + ')') + // You can make your Flux/Mono publish the signals in the RequestContext-aware executor. + .publishOn(Schedulers.fromExecutor(ServiceRequestContext.current().contextAwareExecutor())) + .subscribe(message -> { + // Confirm this callback is being executed on the RequestContext-aware executor. + ServiceRequestContext.current(); + responseObserver.onNext(buildReply(message)); + }, + cause -> { + // Confirm this callback is being executed on the RequestContext-aware executor. + ServiceRequestContext.current(); + responseObserver.onError(cause); + }, + () -> { + // Confirm this callback is being executed on the RequestContext-aware executor. + ServiceRequestContext.current(); + responseObserver.onCompleted(); + }); + } + + /** + * Sends a {@link HelloReply} when a request has been completed with multiple {@link HelloRequest}s. + */ + @Override + public StreamObserver lotsOfGreetings(StreamObserver responseObserver) { + return new StreamObserver() { + final ArrayList names = new ArrayList<>(); + + @Override + public void onNext(HelloRequest value) { + names.add(value.getName()); + } + + @Override + public void onError(Throwable t) { + responseObserver.onError(t); + } + + @Override + public void onCompleted() { + responseObserver.onNext(buildReply(toMessage(String.join(", ", names)))); + responseObserver.onCompleted(); + } + }; + } + + /** + * Sends a {@link HelloReply} when each {@link HelloRequest} is received. The response will be completed + * when the request is completed. + */ + @Override + public StreamObserver bidiHello(StreamObserver responseObserver) { + return new StreamObserver() { + @Override + public void onNext(HelloRequest value) { + // Respond to every request received. + responseObserver.onNext(buildReply(toMessage(value.getName()))); + } + + @Override + public void onError(Throwable t) { + responseObserver.onError(t); + } + + @Override + public void onCompleted() { + responseObserver.onCompleted(); + } + }; + } + + static String toMessage(String name) { + return "Hello, " + name + '!'; + } + + private static HelloReply buildReply(Object message) { + return HelloReply.newBuilder().setMessage(String.valueOf(message)).build(); + } +} diff --git a/armeria-example/armeria-grpc-server/src/main/proto/hello.proto b/armeria-example/armeria-grpc-server/src/main/proto/hello.proto new file mode 100644 index 0000000..59d5ee0 --- /dev/null +++ b/armeria-example/armeria-grpc-server/src/main/proto/hello.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package example.grpc.hello; +option java_package = "com.example.grpc.armeria"; + +service HelloService { + rpc Hello (HelloRequest) returns (HelloReply) {} + rpc LazyHello (HelloRequest) returns (HelloReply) {} + rpc BlockingHello (HelloRequest) returns (HelloReply) {} + rpc LotsOfReplies (HelloRequest) returns (stream HelloReply) {} + rpc LotsOfGreetings (stream HelloRequest) returns (HelloReply) {} + rpc BidiHello (stream HelloRequest) returns (stream HelloReply) {} +} + +message HelloRequest { + string name = 1; +} + +message HelloReply { + string message = 1; +} diff --git a/armeria-example/pom.xml b/armeria-example/pom.xml new file mode 100644 index 0000000..c607b65 --- /dev/null +++ b/armeria-example/pom.xml @@ -0,0 +1,21 @@ + + + + grpc-demos + com.example + 1.0-SNAPSHOT + ../pom.xml + + 4.0.0 + + com.example.armeria + armeria-example + pom + + + armeria-grpc-server + armeria-grpc-client + + diff --git a/chat-example/chat-javafx-client/src/main/java/com/example/grpc/chat/ChatClient.java b/chat-example/chat-javafx-client/src/main/java/com/example/grpc/chat/ChatClient.java index 84704d9..13056aa 100644 --- a/chat-example/chat-javafx-client/src/main/java/com/example/grpc/chat/ChatClient.java +++ b/chat-example/chat-javafx-client/src/main/java/com/example/grpc/chat/ChatClient.java @@ -63,7 +63,7 @@ public void start(Stage primaryStage) { primaryStage.show(); - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 9090).usePlaintext(true).build(); + ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 9090).usePlaintext().build(); ChatServiceGrpc.ChatServiceStub chatService = ChatServiceGrpc.newStub(channel); StreamObserver chat = chatService.chat(new StreamObserver() { @Override diff --git a/chat-example/chat-vaadin-client/pom.xml b/chat-example/chat-vaadin-client/pom.xml index 03e9732..d482b20 100644 --- a/chat-example/chat-vaadin-client/pom.xml +++ b/chat-example/chat-vaadin-client/pom.xml @@ -153,7 +153,7 @@ org.apache.maven.plugins maven-clean-plugin - 3.0.0 + 3.1.0 diff --git a/chat-example/chat-vaadin-client/src/main/java/com/example/chat/ChatUI.java b/chat-example/chat-vaadin-client/src/main/java/com/example/chat/ChatUI.java index e69e447..f6f8818 100644 --- a/chat-example/chat-vaadin-client/src/main/java/com/example/chat/ChatUI.java +++ b/chat-example/chat-vaadin-client/src/main/java/com/example/chat/ChatUI.java @@ -42,7 +42,7 @@ public class ChatUI extends UI { private static final Logger logger = Logger.getLogger(ChatUI.class.getName()); private static final ManagedChannel channel = ManagedChannelBuilder .forAddress("localhost" , 9090) - .usePlaintext(true) + .usePlaintext() .build(); private static final ChatServiceGrpc.ChatServiceStub stub = ChatServiceGrpc.newStub(channel); diff --git a/error-handling-example/error-handling-client/src/main/java/com/example/grpc/client/ErrorHandlingGrpcClient.java b/error-handling-example/error-handling-client/src/main/java/com/example/grpc/client/ErrorHandlingGrpcClient.java index 317cb29..176b30a 100644 --- a/error-handling-example/error-handling-client/src/main/java/com/example/grpc/client/ErrorHandlingGrpcClient.java +++ b/error-handling-example/error-handling-client/src/main/java/com/example/grpc/client/ErrorHandlingGrpcClient.java @@ -34,7 +34,7 @@ public class ErrorHandlingGrpcClient { private static final Logger logger = Logger.getLogger(ErrorHandlingGrpcClient.class.getName()); public static void main(String[] args) throws InterruptedException { ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8080) - .usePlaintext(true) + .usePlaintext() .build(); final EchoRequest request = EchoRequest.getDefaultInstance(); diff --git a/jpa-example/guestbook-ui/src/main/java/com/example/guestbook/ApplicationConfig.java b/jpa-example/guestbook-ui/src/main/java/com/example/guestbook/ApplicationConfig.java index 24716ae..c9e9c1e 100644 --- a/jpa-example/guestbook-ui/src/main/java/com/example/guestbook/ApplicationConfig.java +++ b/jpa-example/guestbook-ui/src/main/java/com/example/guestbook/ApplicationConfig.java @@ -32,7 +32,7 @@ public class ApplicationConfig { @Bean Channel channel() { return ManagedChannelBuilder.forTarget(guestbookServiceEndpoint) - .usePlaintext(true) + .usePlaintext() .build(); } diff --git a/metadata-context-example/src/main/java/com/example/grpc/client/AuthClient.java b/metadata-context-example/src/main/java/com/example/grpc/client/AuthClient.java index c333e77..eeb44ad 100644 --- a/metadata-context-example/src/main/java/com/example/grpc/client/AuthClient.java +++ b/metadata-context-example/src/main/java/com/example/grpc/client/AuthClient.java @@ -36,12 +36,12 @@ public static void main(String[] args) { JwtCallCredential callCredential = new JwtCallCredential(jwt); ManagedChannel greetingChannel = ManagedChannelBuilder.forAddress("localhost", 8080) - .usePlaintext(true) + .usePlaintext() .intercept(new TraceIdClientInterceptor()) .build(); ManagedChannel goodbyeChannel = ManagedChannelBuilder.forAddress("localhost", 9090) - .usePlaintext(true) + .usePlaintext() .intercept(new TraceIdClientInterceptor()) .build(); diff --git a/metadata-context-example/src/main/java/com/example/grpc/server/GoodbyeServer.java b/metadata-context-example/src/main/java/com/example/grpc/server/GoodbyeServer.java index 6cdff42..b43d27f 100644 --- a/metadata-context-example/src/main/java/com/example/grpc/server/GoodbyeServer.java +++ b/metadata-context-example/src/main/java/com/example/grpc/server/GoodbyeServer.java @@ -30,7 +30,7 @@ static public void main(String[] args) throws IOException, InterruptedException JwtServerInterceptor jwtInterceptor = new JwtServerInterceptor(Constant.JWT_SECRET); ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8080) - .usePlaintext(true) + .usePlaintext() .intercept(new JwtClientInterceptor()) .intercept(new TraceIdClientInterceptor()) .build(); diff --git a/pom.xml b/pom.xml index f8885d5..cf47719 100644 --- a/pom.xml +++ b/pom.xml @@ -27,10 +27,10 @@ 1.8 1.8 - 1.20.0 - 1.5.0.Final + 1.31.1 + 1.6.2 0.6.1 - 3.5.1 + 3.13.0 simple-grpc-server @@ -45,6 +45,7 @@ jpa-example kubernetes-lb-example error-handling-example + armeria-example @@ -78,7 +79,7 @@ javax.annotation javax.annotation-api - 1.2 + 1.3.2 @@ -160,7 +161,7 @@ com.spotify dockerfile-maven-plugin - 1.2.2 + 1.4.13 ${docker.image.prefix}/${project.artifactId} latest diff --git a/rxjava-example/rxjava-client/src/main/java/com/example/grpc/client/RxMetricsClient.java b/rxjava-example/rxjava-client/src/main/java/com/example/grpc/client/RxMetricsClient.java index 2bb67e2..8c32007 100644 --- a/rxjava-example/rxjava-client/src/main/java/com/example/grpc/client/RxMetricsClient.java +++ b/rxjava-example/rxjava-client/src/main/java/com/example/grpc/client/RxMetricsClient.java @@ -29,7 +29,7 @@ */ public class RxMetricsClient { public static void main(String[] args) throws InterruptedException, ExecutionException { - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8080).usePlaintext(true).build(); + ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8080).usePlaintext().build(); RxMetricsServiceGrpc.RxMetricsServiceStub rxStub = RxMetricsServiceGrpc.newRxStub(channel); diff --git a/simple-grpc-client/src/main/java/com/example/grpc/client/MyGrpcClient.java b/simple-grpc-client/src/main/java/com/example/grpc/client/MyGrpcClient.java index b6af6a3..01eab57 100644 --- a/simple-grpc-client/src/main/java/com/example/grpc/client/MyGrpcClient.java +++ b/simple-grpc-client/src/main/java/com/example/grpc/client/MyGrpcClient.java @@ -29,7 +29,7 @@ public class MyGrpcClient { public static void main(String[] args) throws InterruptedException { ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8080) - .usePlaintext(true) + .usePlaintext() .build(); GreetingServiceGrpc.GreetingServiceBlockingStub stub = diff --git a/springboot-example-lognet/pom.xml b/springboot-example-lognet/pom.xml index 7dff893..1853848 100644 --- a/springboot-example-lognet/pom.xml +++ b/springboot-example-lognet/pom.xml @@ -16,7 +16,6 @@ 1.8 - Greenwich.RELEASE @@ -25,10 +24,6 @@ guava 27.1-jre - - org.springframework.cloud - spring-cloud-gcp-starter - io.github.lognet grpc-spring-boot-starter @@ -58,24 +53,12 @@ - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - kr.motd.maven os-maven-plugin - 1.5.0.Final + 1.6.2 @@ -88,9 +71,9 @@ protobuf-maven-plugin 0.6.1 - com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier} + com.google.protobuf:protoc:3.6.1:exe:${os.detected.classifier} grpc-java - io.grpc:protoc-gen-grpc-java:1.18.0:exe:${os.detected.classifier} + io.grpc:protoc-gen-grpc-java:1.19.0:exe:${os.detected.classifier} diff --git a/springboot-example/pom.xml b/springboot-example/pom.xml index 3e014c1..b934def 100644 --- a/springboot-example/pom.xml +++ b/springboot-example/pom.xml @@ -15,7 +15,7 @@ 2.1.7.RELEASE - Greenwich.SR1 + Greenwich.SR2 diff --git a/streaming-example/streaming-client/src/main/java/com/example/grpc/client/MetricsClient.java b/streaming-example/streaming-client/src/main/java/com/example/grpc/client/MetricsClient.java index 04827b0..53517cc 100644 --- a/streaming-example/streaming-client/src/main/java/com/example/grpc/client/MetricsClient.java +++ b/streaming-example/streaming-client/src/main/java/com/example/grpc/client/MetricsClient.java @@ -29,7 +29,7 @@ */ public class MetricsClient { public static void main(String[] args) throws InterruptedException { - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8080).usePlaintext(true).build(); + ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8080).usePlaintext().build(); MetricsServiceGrpc.MetricsServiceStub stub = MetricsServiceGrpc.newStub(channel); StreamObserver collect = stub.collect(new StreamObserver() { diff --git a/streaming-example/streaming-client/src/main/java/com/example/grpc/client/MetricsRxClient.java b/streaming-example/streaming-client/src/main/java/com/example/grpc/client/MetricsRxClient.java index 2ec2677..5b09991 100644 --- a/streaming-example/streaming-client/src/main/java/com/example/grpc/client/MetricsRxClient.java +++ b/streaming-example/streaming-client/src/main/java/com/example/grpc/client/MetricsRxClient.java @@ -42,7 +42,8 @@ public Observable collect(Observable metrics = rx.Observable.from(new Long[] {1L, 2L, 3L, 4L, 5L, 6L, 7L}); diff --git a/zipkin-prometheus-example/pom.xml b/zipkin-prometheus-example/pom.xml index 61023fa..11f9650 100644 --- a/zipkin-prometheus-example/pom.xml +++ b/zipkin-prometheus-example/pom.xml @@ -43,7 +43,7 @@ io.zipkin.reporter zipkin-sender-urlconnection - 0.6.1 + 1.1.2 me.dinowernli