Polish RSocket server support

Relax the `NettyRSocketBootstrap` contract to allow all types of
`SocketAcceptor` implementations.

See gh-16021
pull/16554/head
Brian Clozel 6 years ago
parent 2112e02eda
commit 9eb7260699

@ -20,6 +20,7 @@ import java.util.stream.Collectors;
import io.netty.buffer.PooledByteBufAllocator;
import io.rsocket.RSocketFactory;
import io.rsocket.SocketAcceptor;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
@ -106,9 +107,8 @@ public class RSocketServerAutoConfiguration {
@Bean
public NettyRSocketBootstrap nettyRSocketBootstrap(
RSocketServerFactory rSocketServerFactory,
MessageHandlerAcceptor messageHandlerAcceptor) {
return new NettyRSocketBootstrap(rSocketServerFactory,
messageHandlerAcceptor);
SocketAcceptor socketAcceptor) {
return new NettyRSocketBootstrap(rSocketServerFactory, socketAcceptor);
}
}

@ -16,13 +16,14 @@
package org.springframework.boot.rsocket.netty;
import io.rsocket.SocketAcceptor;
import org.springframework.boot.rsocket.context.RSocketServerInitializedEvent;
import org.springframework.boot.rsocket.server.RSocketServer;
import org.springframework.boot.rsocket.server.RSocketServerFactory;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.context.SmartLifecycle;
import org.springframework.messaging.rsocket.MessageHandlerAcceptor;
/**
* Bootstrap an {@link RSocketServer} and start it with the application context.
@ -38,8 +39,8 @@ public class NettyRSocketBootstrap
private ApplicationEventPublisher applicationEventPublisher;
public NettyRSocketBootstrap(RSocketServerFactory serverFactoryProvider,
MessageHandlerAcceptor messageHandlerAcceptorProvider) {
this.rSocketServer = serverFactoryProvider.create(messageHandlerAcceptorProvider);
SocketAcceptor socketAcceptor) {
this.rSocketServer = serverFactoryProvider.create(socketAcceptor);
}
@Override

Loading…
Cancel
Save