Skip to content

armeria-0.65.0

Choose a tag to compare

@trustin trustin released this 31 May 06:09
6f8001d

New features

  • Added ServerBuilder.channelOption() and childChannelOption() so that a user can specify Netty ChannelOptions. #1009 #1189

    ServerBuilder sb = new ServerBuilder();
    sb.channelOption(ChannelOption.SO_BACKLOG, true);
    sb.channelOption(ChannelOption.SO_REUSEADDR, true);
    sb.childChannelOption(ChannelOption.SO_RCVBUF, 1048576);
    sb.childChannelOption(ChannelOption.SO_SNDBUF, 1048576);
  • Added ServiceRequestContext.additionalResponseHeaders() and ClientRequestContext.additionalRequestHeaders() so that a user can specify the additional HTTP headers to send when writing a request or a response. This feature is useful especially for RPC services such as THttpService. #992 #1225

    public class MyThriftServiceImpl implements MyThriftService.AsyncIface {
        @Override
        public void someServiceMethod(MyThriftRequest req,
                                      AsyncMethodCallback<MyThriftResponse> callback) {
            final ServiceRequestContext ctx = RequestContext.current();
            ctx.setAdditionalResponseHeader(HttpHeaderNames.of("my-custom-header"),
                                            "my-custom-value");
            ...
        }
    }
  • You can inject multi-value HTTP headers into a List or similar parameter in annotated services. #1025 #1191

    public class MyAnnotatedService {
        @Post("/post")
        public void post(@Header("item-id") List<Integer> itemIds) { ... }
        //               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    }
  • You can nest @RequestObject annotation in annotated services. #1175 #1191

    public class MyAnnotatedService {
        @Post("/post")
        public void post(@RequestObject MyBean bean) { ... }
        //               ^^^^^^^^^^^^^^^^^^^^^^^^^^
    }
    
    public class MyBean {
        public MyBean(@Param Integer foo, @Header String bar,
                      @RequestObject MyNestedBean nestedBean) { ... }
        //            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    }
    
    public class MyNestedBean { ... }
  • You can inject HTTP cookies into a new dedicated type Cookies in annotated services. #1222

    public class MyAnnotatedService {
        @Post("/post")
        public void post(Cookies cookies) {
            //           ^^^^^^^^^^^^^^^
            for (Cookie c : cookies) {
                System.err.println(c.name() + " = " + c.value());
            }
        }
    }
  • Added various default ResponseConverterFunction implementations for convenient JSON, text and binary response generation in annotated services. #1221

    public class MyAnnotatedService {
        @Get("/json")
        @ProducesJson // Shortcut of @Produces("application/json; charset=utf-8")
        public MyBean getJson() {
           /* ... MyBean will be converted into a JSON document by Jackson ... */
        }
    }
    • We also added @Produces, @Consumes and their various shortcut annotations such as @ProducesJson and @ConsumesJson for convenient media type negotication, consumption and production. See Media type negotiation for more information.

Improvements

  • We changed the default DistributionStatisticConfig so that Micrometer Timers and DistributionSummarys to have sensible settings. We increased the precision of the percentile values and made the histogram buckets are rotated every minute rather than every 40 seconds. #1226

Bug fixes

  • Fixed a bug where DynamicEndpointGroup and its subtypes notify their listeners even when the Endpoint list did not change. We also now sort the Endpoint list. #1216 #1220
  • Fixed a packaging issue where the armeria-tomcat8.5 JAR did not contain any files. #1218

Deprecations

  • ClientFactoryBuilder.socketOption() has been deprecated in favor of channelOption(), so that its naming is consistent with ServerBuilder.channelOption(). #1228
  • @ProduceType and @ConsumeType have been deprecated in favor of @Produces and @Consumes. #1221

Breaking changes

  • The status tag produced by the function returned by MeterIdPrefixFunction.ofDefault() has been renamed to httpStatus for clarity. #1215 #1219
  • ClientRequestContext.HTTP_HEADERS attribute has been removed. Use ClientRequestContext.additionalRequestHeaders #1225

Dependencies

  • Brave 4.19.2 -> 5.0.0
  • fastutil 8.1.1 -> 8.2.1
  • Guava 25.0 -> 25.1
  • RxJava 2.1.13 -> 2.1.14