
Reactor Netty bietet nicht blockierende und gegendruckfähige TCP / HTTP / UDP / QUIC Clients und -Server basierend auf Netty Framework.
Für die Ausführung Reactor Netty ist Java 8 oder höher erforderlich.
Mit Gradle aus repo.spring.io oder Maven Central Repositories (nur stabile Versionen):
repositories {
// maven { url 'https://repo.spring.io/snapshot' }
maven { url ' https://repo.spring.io/milestone ' }
mavenCentral()
}
dependencies {
// compile "io.projectreactor.netty:reactor-netty-core:1.2.2-SNAPSHOT"
compile " io.projectreactor.netty:reactor-netty-core:1.2.1 "
// compile "io.projectreactor.netty:reactor-netty-http:1.2.2-SNAPSHOT"
compile " io.projectreactor.netty:reactor-netty-http:1.2.1 "
} Weitere Informationen zum Abrufen finden Sie in der Referenzdokumentation (z. B. mit Maven oder zum Abrufen von Meilensteinen und Snapshots).
Neu bei Reactor Netty ? Sehen Sie sich diesen Reactor Netty Workshop und die Referenzdokumentation an
Hier ist ein sehr einfacher HTTP Server und das entsprechende HTTP Client-Beispiel
HttpServer . create () // Prepares an HTTP server ready for configuration
. port ( 0 ) // Configures the port number as zero, this will let the system pick up
// an ephemeral port when binding the server
. route ( routes ->
// The server will respond only on POST requests
// where the path starts with /test and then there is path parameter
routes . post ( "/test/{param}" , ( request , response ) ->
response . sendString ( request . receive ()
. asString ()
. map ( s -> s + ' ' + request . param ( "param" ) + '!' )
. log ( "http-server" ))))
. bindNow (); // Starts the server in a blocking fashion, and waits for it to finish its initialization HttpClient . create () // Prepares an HTTP client ready for configuration
. port ( server . port ()) // Obtains the server's port and provides it as a port to which this
// client should connect
. post () // Specifies that POST method will be used
. uri ( "/test/World" ) // Specifies the path
. send ( ByteBufFlux . fromString ( Flux . just ( "Hello" ))) // Sends the request body
. responseContent () // Receives the response body
. aggregate ()
. asString ()
. log ( "http-client" )
. block (); Haben Sie Probleme mit Reactor Netty ? Wir helfen gerne!
reactor-netty . Sie können auch mit der Community auf Gitter chatten.Reactor Netty unter github.com/reactor/reactor-netty/issues. Reactor Netty nutzt das integrierte Issue-Tracking-System GitHub's um Fehler und Funktionsanfragen aufzuzeichnen. Wenn Sie ein Problem ansprechen möchten, befolgen Sie bitte die folgenden Empfehlungen:
Reactor Netty Sie verwenden, sowie Ihr Operating System und JVM Version. Weitere Informationen zum Mitwirken bei Reactor Netty finden Sie in unserem Beitragsleitfaden.
Sie müssen nicht aus dem Quellcode erstellen, um Reactor Netty (Binärdateien in repo.spring.io) zu verwenden. Wenn Sie jedoch das Neueste und Beste ausprobieren möchten, kann Reactor Netty problemlos mit dem Gradle-Wrapper erstellt werden. Sie benötigen außerdem JDK 1.8.
$ git clone https://github.com/reactor/reactor-netty.git
$ cd reactor-netty
$ ./gradlew build Wenn Sie die Artefakte in Ihrem lokalen Maven -Repository veröffentlichen möchten, verwenden Sie Folgendes:
$ ./gradlew publishToMavenLocalhttps://projectreactor.io/docs/netty/release/api/
Reactor Netty ist Open-Source-Software, die unter der Apache-Lizenz 2.0 veröffentlicht wird