Reactor Netty Reference Guide Directory


The original address

This section should help you get started using the Reactor Netty, including the following:

  • Introduce Reactor Netty
  • The premise condition
  • Understand BOM and version plan
  • Access to Reactor Netty

2.1. Introduce the Reactor Netty

Suitable for microservice architectures, Reactor Netty provides a back-pressure networking engine for HTTP (including Websocket), TCP, and UDP.

2.2. Prerequisites

Reactor Netty needs to run on Java 8 and above.

It depends on the following components:

  • Reactive Streams v1.0.3
  • Reactor Core v3.x
  • Netty v4.1. X

2.3. Understand BOM and version plan

Reactor Netty is part of the Project Reactor BOM (since Aluminium was published). Group the artifacts that work better together and provide related versions, although these artifacts may have different version schemes.

The version scheme changed between 0.9.x and 1.0.x (Dysprosium and Europium).

Artifacts follow the version scheme for Major.minor.patch-qualifier, while POM uses the version scheme for YYYY.minor.patch-qualifier, inspired by CalVer.

  • MAJORThis is the current generation of reactors, and each new generation of reactors is likely to bring fundamental changes to the project structure (meaning that there may be significant migration efforts).
  • YYYYIs the year of the first GA release in a given release cycle. (e.g. 1.0.0 for 1.0.x)
  • .MINORA number that starts at 0 and increases with each new release cycle
    • For projects, there are usually major changes, and there may be moderate migration efforts
    • For a BOM, it is possible to differentiate between release cycles in the case of two initial releases in the same year
  • .PATCHThe number starts at 0 and increases each time a service is published
  • -QUALIFIERIs a text modifier, omitted in the GA version (see below)

The first release cycle to follow this convention is 2020.0.x, codenamed Europium. The scheme uses the following qualifiers (note the use of dashes) in the following order:

  • -M1.. -M9: Milestones (we expect no more than 9 service releases per release)
  • -RC1.. -RC9: Release candidates (we expect no more than 9 service releases per release)
  • -SNAPSHOTSnapshot:
  • There are no qualifiers for GA releases

Snapshots are released first of the above types, as they are always the “latest pre-release” in any PATCH. Although the first deployed artifact in a PATCH cycle is always a -snapshot, with a similar name, more recent snapshots are also released after a milestone or between release candidates.

Each release cycle has a code name, a continuation of the previous code name scheme, which can be used in informal situations (for example, in discussions, blog posts, etc.). This code name represents the traditional MAJOR.MINOR number. They are (mostly) from the periodic table, increasing alphabetically.

Up to Dysprosium, versions of the BOM followed a code name with a modifier, and the qualifier was only slightly different. Such as: Aluminium-RELEASE (first GA version, Should now be like YYYY.0.0), Bismuth-M1, Californium-sr1 (service release should now be like YYYY.0.1), dysprosium-rc1, Dysprosium-build-snapshot every time we patch, we go back to the same SNAPSHOT version. It should now be something like YYYY.0.x-snapshot, so we have one SNAPSHOT per PATCH)

2.4. Obtain Reactor Netty

As we mentioned earlier, the easiest way to use a Reactor Netty is to use a BOM and add dependencies to your project. Note that when adding this dependency, do not specify the version so that it can be retrieved from the BOM.

Of course, if you want to force the specified version, you can specify the version you want when you add the dependency. You can also use the dependency of the specified version without using the BOM.

Against 2.4.1. Maven installation

Maven itself supports BOM. First, you need to add the following configuration to pom.xml to introduce the BOM. If there is already a dependencyManagement node in the POM, simply add the configuration directly to it.

<dependencyManagement>< 1 ><dependencies>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-bom</artifactId>
            <version>Dysprosium-SR10</version>< 2 ><type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
Copy the code

<1> Notice the dependencyManagement node. This is outside the Dependencies node.

<2> As of the time this document was written, DysProsiUM-SR10 is the latest BOM version. Visit github.com/reactor/rea… Check for updates.

Next, add the dependency to the relevant responsive project, as usual (except that there is no

node), as follows:

<dependencies>
    <dependency>
        <groupId>io.projectreactor.netty</groupId>
        <artifactId>reactor-netty-core</artifactId>< 1 > < 2 ></dependency>
</dependencies>
<dependencies>
    <dependency>
        <groupId>io.projectreactor.netty</groupId>
        <artifactId>reactor-netty-http</artifactId>
    </dependency>
</dependencies>
Copy the code

<1> Add Reactor Netty dependency

<2> There is no version node

2.4.2. Gradle installation

BOM is supported from Gradle 5. Here is an example of introducing BOM and adding a Reactor Netty dependency:

dependencies {
    // import a BOM
    implementation platform('io.projectreactor:reactor-bom:Dysprosium-SR10') <1>

    // define dependencies without versions
    implementation 'io.projectreactor.netty:reactor-netty-core' <2>
    implementation 'io.projectreactor.netty:reactor-netty-http'
}
Copy the code

<1> As of the time this document was written, DysProsiUM-SR10 is the latest BOM version. Visit github.com/reactor/rea… Check for updates.

<2> There is no third part: the version is a separate part. Obtained from BOM.

2.4.3. Milestones and Snapshots

Milestones and developer previews are distributed through the Spring 1903 Repository instead of Maven Central. To add it to your build profile, use the following code snippet:

Milestones in Maven

<repositories>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones Repository</name>
        <url>https://repo.spring.io/milestone</url>
    </repository>
</repositories>
Copy the code

For Gradle, use the following code snippet:

Milestones in Gradle

repositories {
    maven { url 'https://repo.spring.io/milestone' }
    mavenCentral()
}
Copy the code

2.5. Support and policies

A mirror image of the following entries can be found at github.com/reactor/.gi…

2.5.1. Do you have any more questions?

Look for problems on Stack Overflow first, and start a discussion if necessary

If you’re not sure why it’s not working, or if there’s a better way to do it, look at the problem on Stack Overflow first, and start a discussion if necessary. Use the following relevant tags:

  • Reactor-netty Questions about reactor-netty
  • The project-reactor is about general response questions

If you prefer a live discussion, we also have several Gitter channels:

  • Reactor is one of the most active in reactor’s history, where most communities can help
  • Reactor-core a more sophisticated discussion of internal codebase
  • Reactor-netty Refers to netTY-related issues

Refer to the README file for each project for additional sources of information.

Creating a GitHub Issue to ask questions is generally discouraged, and it is recommended to use the above two methods to ask questions.

2.5.2. Ourdeprecatedpolicy

In deprecation cases, such as a version A.B.C, we ensure that:

  • Deprecated sections in A.B.0 will not be removed prior to A.B+1.0

  • Deprecated parts in A.B.1 will not be removed prior to A.B+2.0

  • We will try to include the following in the deprecated Javadoc:

    • The lowest version to be deleted
    • Indicate an alternative to this not recommended method
    • Method is marked as the deprecated version

    This policy will be implemented in January 2021 and applies to all modules in 2020.0 BOMs and later versions, as well as Dysprosium versions after Dysprosium-SR15.

    Deprecation is not a hard commitment, and deprecated methods may outlast the smallest GA versions (meaning only the most problematic deprecated methods will be removed in a timely manner).

    That is, deprecated code that passes the minimum version that needs to be removed may be removed in any subsequent release (including the patch version, also known as the service version) without further notification. So users should change their code as early as possible.

Suggest Edit to “Getting Started”


Reactor Netty Reference Guide Directory


Copyright notice: If you need to reprint, please bring the link to this article, note the source and this statement. Otherwise, legal liability will be investigated. https://www.immuthex.com/posts/reactor-netty-reference-guide/getting-started