0.84.0 release notes
23rd April 2019
New features
You can now access the detailed timing information for the connection attempts made by Armeria via
RequestLogAPI, including DNS lookup and socket connect time. #1692HttpClient client = new HttpClientBuilder("https://example.com/") .decorator((delegate, ctx, req) -> { ctx.log().addListener(log -> { ClientConnectionTimings timings = ClientConnectionTimings.get(log); System.err.printf("Total time taken: %d ns%n", timings.connectionAcquisitionDurationNanos()); System.err.printf("DNS lookup: %d ns%n", timings.dnsResolutionDurationNanos()); System.err.printf("Socket connect:: %d ns%n", timings.socketConnectDurationNanos()); }, RequestLogAvailability.REQUEST_START); return delegate.execute(ctx, req); }) .build(); client.get("/");You can now customize server-side
SslContextmore conveniently. #1717ServerBuilder sb = new ServerBuilder(); sb.tls(certChainFile, keyFile, tlsContextBuilder -> { // Use JDK SSLEngine instead of OpenSSL. tlsContextBuilder.sslProvider(SslProvider.JDK); });Server.stop()is now able to stop itsblockingTaskExecutor. You have to specify whether to stop theblockingTaskExecutoryou specified or not when callingServerBuilder.blockingTaskExecutor()from this release. #1685 #1707ServerBuilder sb = new ServerBuilder(); // The thread pool will be terminated when the server stops. sb.blockingTaskExecutor(Executors.newFixedThreadPool(100), true);The usability of
RedirectServicehas been improved with some API changes. #1725 #1726RedirectServicepreserves the query string by default. The query string of the old location was dropped previously.- Added
preserveQueryStringconstructor parameter. Specifyingfalsewill let you go back to the previous behavior.
The usability of
SettableHealthCheckerhas been improved with some API changes. #1714SettableHealthChecker's initial healthiness is nowtrue. It wasfalsepreviously.- You can now specify the initial healthiness when instantiating
SettableHealthChecker.SettableHealthChecker myHealthChecker = new SettableHealthChecker(false); ServerBuilder sb = new ServerBuilder(); sb.service("/monitor/health", new HttpHealthCheckService(myHealthChecker)); SettableHealthChecker.setHealthy(boolean)is now chainable. #1714// Same with: new SettableHealthChecker(false) SettableHealthChecker myHealthChecker = new SettableHealthChecker().setHealthy(false);
You can now specify different path mappings for different CORS policies. #1698 #1699
Using a builder pattern:
ServerBuilder sb = new ServerBuilder(); // Add two services under /foo and /bar. sb.service("prefix:/foo", fooService); sb.service("prefix:/bar", barService); // Enable CORS for: // - GET and POST requests for all resources under http://example.com/foo/ // - GET request for all resources under http://example.com/bar/ sb.decorator(CorsServiceBuilder.forOrigins("http://example.com") .pathMapping("prefix:/foo") .allowCredentials() .allowRequestMethods(HttpMethod.GET, HttpMethod.POST) .andForOrigins("http://example.com") .pathMapping("prefix:/bar") .allowCredentials() .allowRequestMethods(HttpMethod.GET) .and() .newDecorator());Using annotations:
sb.annotatedService( @CorsDecorator( origins = "http://example.com", pathPatterns = "prefix:/foo", credentialsAllowed = true, allowedRequestMethods = { HttpMethod.GET, HttpMethod.POST }) @CorsDecorator( origins = "http://example.com", pathPatterns = "prefix:/bar", credentialsAllowed = true, allowedRequestMethods = { HttpMethod.GET }) new Object() { ... });
You can now build a gRPC service without depending on upstream gRPC API. #1720 #1727
Added
armeria-grpc-protocolwhich provides a core functionality required for building a gRPC service, which does not depend onio.grpc:grpc-javabut only oncom.google.protobuf:protobuf-java.Added
AbstractUnaryGrpcServicewhich allows you to implement a unary gRPC easily without depending onio.grpc:grpc-java.class MyUnaryGrpcService extends AbstractUnaryGrpcService { @Override protected CompletableFuture<byte[]> handleMessage(byte[] message) { final MyGrpcRequest req; try { req = MyGrpcRequest.parseFrom(message); } catch (InvalidProtocolBufferException e) { throw new UncheckedIOException(e); } MyGrpcResponse res = MyGrpcResponse.newBuilder()...build(); return UnmodifiableFuture.completedFuture(res.toByteArray()); } }
Spring Boot integration now has content encoding options. #1716
# Your application.yml: armeria: ports: - port: 8080 protocols: HTTP compression: enabled: true mime-types: text/*, application/json excluded-user-agents: some-user-agent, another-user-agent minResponseSize: 1KB
Bug fixes
- The default path pattern now handles a trailing slash properly. #1730 #1735
TwoElementFixedStreamMessageno longer throws anIllegalReferenceCountException. #1687 #1695DnsEndpointGroupdoes not ignore thesearchdirective in/etc/resolv.confanymore. This fix should be useful for users in Kubernetes environment. #1694 #1697DocServiceno longer raises aNullPointerExceptionfor a certain gRPC service metadata. #1705 #1715- An unframed gRPC service no longer becomes unresponsive when sending a response without content #1723
THttpServiceno longer fails to load the service metadata when.thriftfile was compiled with theprivate-membersoption. #1728 #1729THttpServiceno longer fails to load the service metadata when.thriftfile defines a service that extends other service. #1734HttpTracingClientandHttpTracingServicedo not fill service name automatically with host names or IP addresses anymore. #1706- Spring integration module now respects the
com.linecorp.armeria.useOpenSslflag properly. #1713
Deprecations
ServerBuilder.blockingTaskExecutor(Executor)has been deprecated. UseServerBuilder.blockingTaskExecutor(Executor, boolean). #1685 #1707TextFormatter.epoch()andappendEpoch()have been deprecated. UseTextFormatter.epochMillis()andappendEpochMillis(). #1692
Breaking changes
- The initial healthiness of
SettableHealthCheckeris nowtrue. #1714 RedirectServicepreserves the query string by default. The query string of the old location was dropped previously. #1725 #1726
Dependencies
- gRPC 1.19.0 -> 1.20.0
- Protobuf 3.6.1 -> 3.7.1
- Jetty 9.4.15 -> 9.4.17
- Micrometer 1.1.3 -> 1.1.4
- Spring Boot 2.1.3 -> 2.1.4, 1.5.19 -> 1.5.20
- Tomcat 9.0.17 -> 9.0.19, 8.5.39 -> 8.5.40
- ZooKeeper 3.4.13 -> 3.4.14