Eclipse Vert.x 是一个微服务开发框架,基于事件和异步,依托于全异步 Java 服务器 Netty,并扩展了很多其他特性,以其轻量、高性能、支持多语言开发而备受开发者青睐。

Eclipse Vert.x 版本 4.5.8 现已发布,一些重点更新内容如下:

Future expectation + HTTP response expectations

可以使用 HTTP/Web 客户端的新功能来促进 HTTP 交互,此新功能将使用基于新 expectation based API 取代 Web 客户端响应谓词 API,为 HTTP 和 Web 客户端提供相同的功能。

client  .get(8080, "myserver.mycompany.com", "/some-uri")  .send()  .expecting(HttpResponseExpectation.SC_OK.and(HttpResponseExpectation.JSON))  .onSuccess(res -> {    // ....  });

这个特性实际上是建立在一个新的Future#expecting运算符之上的,该运算符可以同步检查谓词类Expectation运算符的响应

Future.succeededFuture("hello")   .expecting(res -> true)   .onSuccess(s -> System.out.printl("Expectation met"));Future.succeededFuture("hello")   .expecting(res -> false)   .onFailure(s -> System.out.printl("Expectation not met"));

它有多种用途,例如HttpResponseExpectation为 HTTP 和 Web 客户端提供 reusable ex­pec­ta­tions,它还可以方便测试,例如:

public static <T> Expectation<T> that(Consumer<? super T> consumer) {  return value -> {    consumer.accept(value);    return true;  };}@Testpublic void someTest() {  Future<Result> fut = getSomeFuture()     .expecting(that(res -> assertNotNull(res)));}

默认 Hazelcast 版本

Hazelcast 依赖项更改为 5.3,因为 Hazelcast 4 不再受支持且 4.2.8 存在已知漏洞(CVE-2023-45860、CVE-2023-45859、CVE-2023-33265、CVE-2023-33264)。

集群管理器仍使用 Hazelcast 4.2.8 和 5.3 进行测试,因此 4.2.8 仍然受支持,如果需要,必须将 Hazelcast 版本明确设置为 4.2.8,直到实现升级。

更多详情可查看 4.5.8 发行说明以及弃用和破坏性变更

免责声明:本文系转载,版权归原作者所有;旨在传递信息,不代表一休教程网的观点和立场。