50

Thorntail 2.2.0提供从WildFly Swarm自动迁移的特性

 5 years ago
source link: http://www.infoq.com/cn/news/2018/09/red-hat-releases-thorntail-2.2.0?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

自6月底宣布把 WildFly Swarm 2018.5.0 改名Thorntail 2.0.0以来,Red Hat在8月中旬以后的三个周里发布了Thorntail  2.1.0 版本和 2.2.0 版本。除了许多 Bug修复 外,尤其是和 MicroProfile 相关的,新特性还包括:

  • 符合MicroProfile 1.3
  • 自动迁移过程

由于修改了OpenTracing、Jaeger及日志消息代码,Red Hat记录了可能带来的一些代码破坏。

背景

传统的 WildFly Swarm 以Red Hat的开源应用程序服务器 WildFly 为基础。和传统的单体应用程序服务器一样,部署在WildFly上面的应用程序如下图所示。

11io1-1538063346562.png

另一方面,WildFly Swarm是WildFly的一个“解构”版本,开发人员只需要为打包成UberJar运行的应用程序选择所需的API。下图的应用程序仅使用了JAX-RS。

11in2-1538063530884.png

Thorntail 2.0.0

在最近接受InfoQ采访时,对于改名,Red Hat资深咨询工程师Bob McWhirter指出:

虽然“WildFly Swarm”这个名字已经使用多年,但我们注意到,“Swarm”已经被用烂了,许多公司和项目都在用它。此外,随着我们把项目迁移到一个新的架构,在名字中包含“WildFly”开始变得没有意义。在开始的时候,我们其实是核心WildFly项目的一个扩展,但是,随着项目逐步成熟,我们需要自己的标识。出于这两个原因,我们决定起一个新名。

在名称变更的同时,Red Hat放弃了最近比较流行的版本命名格式 YYYY.MM.VV ,回到了更为传统的命名格式 major.minor.micro 。因此,就从WildFly Swarm 2018.5.0变成了Thorntail 2.0.0。

根据Red Hat的文档,把一个Maven项目从WildFly Swarm迁移到Thorntail的过程如下:

  • groupId 中任何对 org.wildfly.swarm 的引用改成 io.thorntail
  • 修改对WildFly Swarm版本的所有引用,如 2018.5.02.0.0.Final
  • artifactId 中任何对 wildfly-swarm-plugin 的引用改成 thorntail-maven-plugin
  • 生成的UberJar包后缀由 swarm.jar 改成 -thorntail.jar
  • Maven插件名称从 wildfly-swarm:run 改成 thorntail:run

因此,下面的WildFly Swarm Java和Maven命令:

$ java -jar target/demo-0.1.0-swarm.jar
$ mvn wildfly-swarm:run

变成了下面的Thorntail命令:

$ java -jar target/demo-0.1.0-thorntail.jar
$ mvn thorntail:run

Thorntail 2.1.0

Thorntail通过 SmallRye 保持了与 MicroProfile 1.3的完全一致。SmallRye是一个社区驱动的新组织,提供MicroProfile规范的共享实现。 Ken Finnigan 是Red Hat的高级首席软件工程师,他发起成立了SmallRye。在Red Hat最近发表的一篇 博文 中,他写道:

MicroProfile发展迅速,从两年前宣布以来已经有了很大的发展。跟踪规范的快速发展以及与之匹配的实现需要所有供应商付出大量的精力,因此,Ken提议,把这些实现工作的公共部分置入一个供应商无关的MicroProfile实现中,这个项目的名字就是SmallRye。

smallrye.io 网站上,你可以看到,这个社区驱动的项目做得很好;所有MicroProfile规范现在都有了它们自己的实现。

GitHub 上提供了SmallRye的源代码。

2.1.0版本引入了一种Maven项目自动迁移机制,通过执行下面的Maven命令就可以把项目从WildFly Swarm迁移到Thorntail:

mvn io.thorntail:thorntail-maven-plugin:2.1.0.Final:migrate-from-wildfly-swarm

这将把所有 groupIdartifactId 引用从WildFly Swarm修改为Thorntail,包括相应的版本号。

<properties>
    <version.wildfly.swarm>2018.5.0</version.wildfly.swarm>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>bom</artifactId>
            <version>${version.wildfly.swarm}</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>
<properties>
    <version.wildfly.swarm>2.1.0.Final</version.wildfly.swarm>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.thorntail</groupId>
            <artifactId>bom</artifactId>
            <version>${version.wildfly.swarm}</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

JaegerOpen Tracing 中有一项修改可能带来代码破坏。之前,把Jaeger添加到项目意味着把MicroProfile的Open Tracing包含进来。然而,2.1.0版本为了更好的支持Open Tracing,把它从Jaeger解耦了。正如 发布声明 中所说的那样:

现在, jaeger 部分只用于提供跟踪程序配置。你需要手工引入跟踪部分;可以是以前的 opentracing ,也可以是新的 microprofile-opentracing

如果你之前依赖 jaeger 部分,而不是 opentracing 部分,那么你必须显式添加对 opentracing 部分的依赖才能保证同样的行为。

Thorntail 2.2.0

最新版本修复了许多Bug,尤其是和MicroProfile APIs、 MetricsJWTOpenAPIRest Client 相关的。

2.2.0版本引入了新的日志消息代码,以反映Thorntail的命名变化。之前的 WFSWARMnnnnnWFSxxxnnnnn 现在成了 THORNnnnnnTTxxxnnnnn 。数值代码保持不变。对于使用解析器搜索旧日志代码的开发人员而言,这是唯一的破坏性修改。

新标志

他们故意延迟Thorntail新标志的发布。McWhirter在最近接受InfoQ采访时解释说:

该标志目前正由杰出的JBoss.org设计团队进行设计。我们希望在接下来几周内可以有几个候选。考虑到 Red Hat峰会 ,我们希望在发布标志之前发布名称,再者,我们也希望推广新的 v4.x概念验证 架构。

等待已经结束,因为新标志已于2018年9月17日发布:

1672-1538064526722.jpg


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK