Skip to content

armeria-0.41.0

Choose a tag to compare

@trustin trustin released this 21 Mar 10:01
· 4339 commits to main since this release

New features

  • #455 #465 Add RequestContext.onChild() which adds a callback that is invoked when a child context replaces the current context

    • This is useful especially when you want to inherit an attribute of the current context to its children:

      AttributeKey<UserInfo> CURRENT_USER = ...;
      RequestContext ctx = ...;
      ctx.onChild((curCtx, newCtx) -> {
          newCtx.attr(CURRENT_USER).set(curCtx.attr(CURRENT_USER).get());
      });
  • #460 Add DynamicEndpointGroup which notifies its listeners when its list of Endpoints changes

    • HealthCheckedEndpointGroup and ZooKeeperEndpointGroup extends DynamicEndpointGroup.
  • #471 Provide more simpler ways to write a decorating client/server

    • Add DecoratingClientFunction which is similar to DecoratingServiceFunction:

      ServerBuilder sb = new ServerBuilder();
      sb.serviceUnder("/my_service",
                      new MyService().decorate((delegate, ctx, req) -> {
                          // Intercept an incoming request here.
                          return delegate.serve(ctx, req);
                      });
      
      ClientBuilder cb = new ClientBuilder(...);
      cb.decorator(HttpRequest.class, HttpResponse.class,
                   (delegate, ctx, req) -> {
                       // Intercept an outgoing request here.
                       return delegate.execute(ctx, req);
                   });
    • Add SimpleDecoratingService and SimpleDecoratingClient, which is similar to DecoratingService and DecoratingClient but with fewer number of type parameters:

      public class MyDecoratingService extends SimpleDecoratingService<RpcRequest, RpcResponse> { ... }
      public class MyDecoratingClient extends SimpleDecoratingClient<RpcRequest, RpcResponse> { ... }

Improvements

  • (Potentially breaking) #457 Cancel context-aware callbacks automatically if the context has been timed out already

Bug fixes

  • #458 #464 Choose correct SerializationFormat when content-type is application/x-thrift without the protocol parameter
  • #462 #463 NullPointerException at ServiceRequestContext.toString()
  • #466 Handle FilteredHttpResponse completion callbacks correctly in the case of no encoding