Skip to content

RSocket Auto-Configuration: Make RSocketWebSocketNettyRouteProvider public #18549

@FWinkler79

Description

@FWinkler79

Used Spring Versions

Used Spring Boot Version: 2.2.0.BUILD-SNAPSHOT
Used Spring Version: 5.2
User Spring Cloud Version: Hoxton.M2
Sample Project: https://github.com/FWinkler79/SpringCloudPlatform/tree/Issue-SpringBootRsocketAutoconfig

What's the issue?

RSocketWebSocketNettyRouteProvider is package protected and is declared in RSocketServerAutoConfiguration#WebFluxServerAutoConfiguration as an overridable bean named rSocketWebsocketRouteProvider.

I would like to override that bean, since for now this is the only reasonable way to configure the ServerRSocketFactory to add things like lease handling. See this stackoverflow question which describes the reason why I need to do it like that currently.

In order to override the rSocketWebsocketRouteProvider bean, I either need to place my bean configuration in the same package as RSocketWebSocketNettyRouteProvider (which then might cause all kinds of component scan issues) or I need to create a subclass of it, in the same package (which is my current solution).

Generally, it is tedious having to do so, and could be avoided, if the RSocketWebSocketNettyRouteProvider were a public class.

Expected Solution

  1. Make RSocketWebSocketNettyRouteProvider public.
  2. Make it possible for an application to define an arbitrary number of @Ordered ServerRSocketFactoryCustomizer beans that will be picked up to modify the auto-configured ServerRSocketFactory (as described on stack overflow)
  3. Consider exposing ServerRSocketFactory (created in RSocketWebSocketNettyRouteProvider#apply(...)) as a bean. That would allow applications to easily add additional configurations to it.

Sample Project

You can find a sample project that shows the current solution here.

To get it started, proceed as follows:

  1. start Zipkin (using scripts/startZipkin.sh
  2. start RabbitMQ (using scripts/startRabbit.sh
  3. start service-registry
  4. start config-server
  5. start rsocket-server
  6. start rsocket-client

Notice class CustomRSocketWebSocketNettyRouteProvider in rsocket-server which is a subclass of RSocketWebSocketNettyRouteProvider and that it needs to be declared in a Spring Boot auto-config package.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions