-
Notifications
You must be signed in to change notification settings - Fork 38k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements to RSocketStrategies #23314
Comments
Here's a summary of the current situation:
We could add an optional dependency from We could use a 100% reflection approach for this case, but one could argue that we're usually not in the business of conditional configuration for Spring dependencies (usually Spring Boot is in charge of that). The third alternative would be to move that Flagging this for team attention. |
Team Decision: Add a small number of extensions in |
1. RSocketStrategies hooks in the basic codecs from spring-core by default. Now that we have support for composite metadata, it makes sense to have multiple codecs available. 2. RSocketStrategies is pre-configured with NettyDataBufferFactory. 3. DefaultRSocketRequesterBuilder configures RSocket with a frame decoder that matches the DataBufferFactory choice, i.e. ensuring consistency of zero copy vs default (copy) choice. 4. DefaultRSocketRequesterBuilder now tries to find a single non-basic decoder to select a default data MimeType (e.g. CBOR), or otherwise fall back on the first default decoder (e.g. String). See gh-23314
RouteMatcher and MetadataExtractor can now be configured on and accessed through RSocketStrategies. This simplifies configuration for client and server responders. See gh-23314
Now that RSocketStrategies has default settings it makes sense to have a create() shortcut vs builder().build(). This commit also updates tests to take advantage of improvements in this and the previous two commits. See gh-23314
Now that responder RSocketStrategies also exposes responder strategies, AnnotationClientResponderConfigurer is reduced and no longer needs to be public. This commit folds it into RSocketMessageHandler as a nested class and exposes it as a ClientRSocketFactoryConfigurer through a static method that accepts the handlers to use. Effectively a shortcut for creating RSocketMessageHandler, giving it RSocketStrategies, calling afterPropertiesSet, and then the instance createResponder. See gh-23314
In the end this turned into a series of improvements in spring-messaging.
See commit messages for the above commits for more details. |
Since spring-projects/spring-framework#23314, the `RSocketStrategies` provide more codecs by default, and there is no need to order them to avoid conflicts during mime type selection. This commit also ensures that the `PayloadDecoder.ZERO_COPY` is configured on the RSocket server if the configured `DataBufferFactory` is compatible with that strategy.
Since spring-projects/spring-framework#23314 and the following commit spring-projects/spring-framework@be4facef1b, the RSocket codec selection is relaxed and the order of configured commits matters again. This commit ensures that the CBOR codec is configured ahead of the JSON codec so that it can be chosen first if no data mime type is specified when a connection is established with a client requester.
After a change in Spring Framework (see spring-projects/spring-framework#23314), the `RouteMatcher` to be used with the RSocket infrastructure is configured on the `RSocketStrategies` directly. This commit moves the auto-configuration of the `PathPatternRouteMatcher` from the message handling parts to the RSocket strategy one. Closes gh-17571
After a change in Spring Framework (see spring-projects/spring-framework#23314), the `RouteMatcher` to be used with the RSocket infrastructure is configured on the `RSocketStrategies` directly. This commit moves the auto-configuration of the `PathPatternRouteMatcher` from the message handling parts to the RSocket strategy one. Closes spring-projectsgh-17571
We should try and use the
PathPatternRouteMatcher
as a defaultRouteMatcher
implementation in the RSocket infrastructure if it is available (i.e. ifspring-web
is on the classpath).The text was updated successfully, but these errors were encountered: