Polish "Reference Spring Framework RSocket section + polish"
See gh-18321
This commit is contained in:
parent
9a70b5d1f5
commit
60b1bbb8b2
|
@ -2931,11 +2931,8 @@ https://rsocket.io[RSocket] is a binary protocol for use on byte stream transpor
|
|||
It enables symmetric interaction models via async message passing over a single connection.
|
||||
|
||||
|
||||
The `spring-messaging` module of the Spring Framework provides support for RSocket requesters and
|
||||
responders, both on the client and on the server side. See the
|
||||
https://docs.spring.io/spring/docs/5.2.0.BUILD-SNAPSHOT/spring-framework-reference/web-reactive.html#rsocket-spring[RSocket section]
|
||||
of the Spring Framework reference for more details, including an overview of the RSocket protocol.
|
||||
|
||||
The `spring-messaging` module of the Spring Framework provides support for RSocket requesters and responders, both on the client and on the server side.
|
||||
See the {spring-framework-docs}web-reactive.html#rsocket-spring[RSocket section] of the Spring Framework reference for more details, including an overview of the RSocket protocol.
|
||||
|
||||
|
||||
[[boot-features-rsocket-strategies-auto-configuration]]
|
||||
|
@ -2947,18 +2944,18 @@ By default, the auto-configuration will try to configure the following (in order
|
|||
. JSON codecs with Jackson
|
||||
|
||||
The `spring-boot-starter-rsocket` starter provides both dependencies.
|
||||
Check out the <<boot-features-json-jackson,Jackson support section>> to know more about customization possibilities.
|
||||
|
||||
Developers can customize the `RSocketStrategies` component by creating beans that implement the `RSocketStrategiesCustomizer` interface.
|
||||
Note that their `@Order` is important, as it determines the order of codecs.
|
||||
|
||||
|
||||
|
||||
[[boot-features-rsocket-server-auto-configuration]]
|
||||
=== RSocket server Auto-configuration
|
||||
Spring Boot provides RSocket server auto-configuration.
|
||||
The required dependencies are provided by the `spring-boot-starter-rsocket`.
|
||||
|
||||
Spring Boot allows exposing RSocket over WebSocket from a WebFlux server, or standing up an independent RSocket TCP server.
|
||||
Spring Boot allows exposing RSocket over WebSocket from a WebFlux server, or standing up an independent RSocket server.
|
||||
This depends on the type of application and its configuration.
|
||||
|
||||
For WebFlux application (i.e. of type `WebApplicationType.REACTIVE`), the RSocket server will be plugged into the Web Server only if the following properties match:
|
||||
|
@ -2972,7 +2969,7 @@ For WebFlux application (i.e. of type `WebApplicationType.REACTIVE`), the RSocke
|
|||
|
||||
WARNING: Plugging RSocket into a web server is only supported with Reactor Netty, as RSocket itself is built with that library.
|
||||
|
||||
Alternatively, an RSocket TCP server is started as an independent, embedded server.
|
||||
Alternatively, an RSocket TCP or websocket server is started as an independent, embedded server.
|
||||
Besides the dependency requirements, the only required configuration is to define a port for that server:
|
||||
|
||||
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
|
||||
|
@ -2987,23 +2984,19 @@ Besides the dependency requirements, the only required configuration is to defin
|
|||
=== Spring Messaging RSocket support
|
||||
Spring Boot will auto-configure the Spring Messaging infrastructure for RSocket.
|
||||
|
||||
An `RSocketStrategies` bean is created to provide encoding and decoding support for RSocket messages.
|
||||
By default, Spring Boot will try to auto-configure JSON support with Jackson for `application/json` and `"application/*+json"` media types.
|
||||
Check out the <<boot-features-json-jackson,Jackson support section>> to know more about customization possibilities.
|
||||
|
||||
Developers can create `RSocketStrategiesCustomizer` beans to add other strategies, assuming there are `Encoder` and `Decoder` implementations available.
|
||||
|
||||
This means that Spring Boot will create a `RSocketMessageHandler` bean that will handle RSocket requests to your application.
|
||||
|
||||
|
||||
[[boot-features-rsocket-requester]]
|
||||
=== Calling RSocket Services with `RSocketRequester`
|
||||
Once the `RSocket` channel is established between server and client, any party can send or receive requests to the other.
|
||||
|
||||
As a server, you can get injected an `RSocketRequester` instance on any handler method of an RSocket `@Controller`.
|
||||
As a server, you can get injected with an `RSocketRequester` instance on any handler method of an RSocket `@Controller`.
|
||||
As a client, you need to configure and establish an RSocket connection first.
|
||||
Spring Boot auto-configures an `RSocketRequester.Builder` for such cases with the expected codecs.
|
||||
|
||||
The `RSocketRequester.Builder` instance is a prototype bean, meaning each injection point will provide you with a new instance - this is done on purpose since this builder is stateful and you shouldn't create requesters with different setups using the same instance.
|
||||
The `RSocketRequester.Builder` instance is a prototype bean, meaning each injection point will provide you with a new instance .
|
||||
This is done on purpose since this builder is stateful and you shouldn't create requesters with different setups using the same instance.
|
||||
|
||||
The following code shows a typical example:
|
||||
|
||||
|
@ -3016,7 +3009,7 @@ The following code shows a typical example:
|
|||
|
||||
public MyService(RSocketRequester.Builder rsocketRequesterBuilder) {
|
||||
this.rsocketRequester = rsocketRequesterBuilder
|
||||
.connectTcp("example.org", 9090).block();
|
||||
.connectTcp("example.org", 9898).block();
|
||||
}
|
||||
|
||||
public Mono<User> someRSocketCall(String name) {
|
||||
|
|
Loading…
Reference in New Issue