|
|
@ -37,7 +37,7 @@ import org.springframework.boot.context.properties.PropertyMapper;
|
|
|
|
import org.springframework.boot.rsocket.context.RSocketServerBootstrap;
|
|
|
|
import org.springframework.boot.rsocket.context.RSocketServerBootstrap;
|
|
|
|
import org.springframework.boot.rsocket.netty.NettyRSocketServerFactory;
|
|
|
|
import org.springframework.boot.rsocket.netty.NettyRSocketServerFactory;
|
|
|
|
import org.springframework.boot.rsocket.server.RSocketServerFactory;
|
|
|
|
import org.springframework.boot.rsocket.server.RSocketServerFactory;
|
|
|
|
import org.springframework.boot.rsocket.server.ServerRSocketFactoryCustomizer;
|
|
|
|
import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Conditional;
|
|
|
|
import org.springframework.context.annotation.Conditional;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
@ -70,11 +70,9 @@ public class RSocketServerAutoConfiguration {
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
RSocketWebSocketNettyRouteProvider rSocketWebsocketRouteProvider(RSocketProperties properties,
|
|
|
|
RSocketWebSocketNettyRouteProvider rSocketWebsocketRouteProvider(RSocketProperties properties,
|
|
|
|
RSocketMessageHandler messageHandler, ObjectProvider<ServerRSocketFactoryCustomizer> customizers) {
|
|
|
|
RSocketMessageHandler messageHandler, ObjectProvider<ServerRSocketFactoryProcessor> processors) {
|
|
|
|
RSocketWebSocketNettyRouteProvider routeProvider = new RSocketWebSocketNettyRouteProvider(
|
|
|
|
return new RSocketWebSocketNettyRouteProvider(properties.getServer().getMappingPath(),
|
|
|
|
properties.getServer().getMappingPath(), messageHandler.responder());
|
|
|
|
messageHandler.responder(), processors.orderedStream());
|
|
|
|
routeProvider.setCustomizers(customizers.orderedStream().collect(Collectors.toList()));
|
|
|
|
|
|
|
|
return routeProvider;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -92,14 +90,14 @@ public class RSocketServerAutoConfiguration {
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
RSocketServerFactory rSocketServerFactory(RSocketProperties properties, ReactorResourceFactory resourceFactory,
|
|
|
|
RSocketServerFactory rSocketServerFactory(RSocketProperties properties, ReactorResourceFactory resourceFactory,
|
|
|
|
ObjectProvider<ServerRSocketFactoryCustomizer> customizers) {
|
|
|
|
ObjectProvider<ServerRSocketFactoryProcessor> processors) {
|
|
|
|
NettyRSocketServerFactory factory = new NettyRSocketServerFactory();
|
|
|
|
NettyRSocketServerFactory factory = new NettyRSocketServerFactory();
|
|
|
|
factory.setResourceFactory(resourceFactory);
|
|
|
|
factory.setResourceFactory(resourceFactory);
|
|
|
|
factory.setTransport(properties.getServer().getTransport());
|
|
|
|
factory.setTransport(properties.getServer().getTransport());
|
|
|
|
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
|
|
|
|
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
|
|
|
|
map.from(properties.getServer().getAddress()).to(factory::setAddress);
|
|
|
|
map.from(properties.getServer().getAddress()).to(factory::setAddress);
|
|
|
|
map.from(properties.getServer().getPort()).to(factory::setPort);
|
|
|
|
map.from(properties.getServer().getPort()).to(factory::setPort);
|
|
|
|
factory.setServerCustomizers(customizers.orderedStream().collect(Collectors.toList()));
|
|
|
|
factory.setServerProcessors(processors.orderedStream().collect(Collectors.toList()));
|
|
|
|
return factory;
|
|
|
|
return factory;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -111,8 +109,7 @@ public class RSocketServerAutoConfiguration {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
ServerRSocketFactoryCustomizer frameDecoderServerFactoryCustomizer(
|
|
|
|
ServerRSocketFactoryProcessor frameDecoderServerFactoryCustomizer(RSocketMessageHandler rSocketMessageHandler) {
|
|
|
|
RSocketMessageHandler rSocketMessageHandler) {
|
|
|
|
|
|
|
|
return (serverRSocketFactory) -> {
|
|
|
|
return (serverRSocketFactory) -> {
|
|
|
|
if (rSocketMessageHandler.getRSocketStrategies()
|
|
|
|
if (rSocketMessageHandler.getRSocketStrategies()
|
|
|
|
.dataBufferFactory() instanceof NettyDataBufferFactory) {
|
|
|
|
.dataBufferFactory() instanceof NettyDataBufferFactory) {
|
|
|
|