Polish RSocket server support
Relax the `NettyRSocketBootstrap` contract to allow all types of `SocketAcceptor` implementations. See gh-16021
This commit is contained in:
parent
2112e02eda
commit
9eb7260699
|
|
@ -20,6 +20,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import io.netty.buffer.PooledByteBufAllocator;
|
import io.netty.buffer.PooledByteBufAllocator;
|
||||||
import io.rsocket.RSocketFactory;
|
import io.rsocket.RSocketFactory;
|
||||||
|
import io.rsocket.SocketAcceptor;
|
||||||
|
|
||||||
import org.springframework.beans.factory.ObjectProvider;
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||||
|
|
@ -106,9 +107,8 @@ public class RSocketServerAutoConfiguration {
|
||||||
@Bean
|
@Bean
|
||||||
public NettyRSocketBootstrap nettyRSocketBootstrap(
|
public NettyRSocketBootstrap nettyRSocketBootstrap(
|
||||||
RSocketServerFactory rSocketServerFactory,
|
RSocketServerFactory rSocketServerFactory,
|
||||||
MessageHandlerAcceptor messageHandlerAcceptor) {
|
SocketAcceptor socketAcceptor) {
|
||||||
return new NettyRSocketBootstrap(rSocketServerFactory,
|
return new NettyRSocketBootstrap(rSocketServerFactory, socketAcceptor);
|
||||||
messageHandlerAcceptor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,14 @@
|
||||||
|
|
||||||
package org.springframework.boot.rsocket.netty;
|
package org.springframework.boot.rsocket.netty;
|
||||||
|
|
||||||
|
import io.rsocket.SocketAcceptor;
|
||||||
|
|
||||||
import org.springframework.boot.rsocket.context.RSocketServerInitializedEvent;
|
import org.springframework.boot.rsocket.context.RSocketServerInitializedEvent;
|
||||||
import org.springframework.boot.rsocket.server.RSocketServer;
|
import org.springframework.boot.rsocket.server.RSocketServer;
|
||||||
import org.springframework.boot.rsocket.server.RSocketServerFactory;
|
import org.springframework.boot.rsocket.server.RSocketServerFactory;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
import org.springframework.context.ApplicationEventPublisherAware;
|
import org.springframework.context.ApplicationEventPublisherAware;
|
||||||
import org.springframework.context.SmartLifecycle;
|
import org.springframework.context.SmartLifecycle;
|
||||||
import org.springframework.messaging.rsocket.MessageHandlerAcceptor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap an {@link RSocketServer} and start it with the application context.
|
* Bootstrap an {@link RSocketServer} and start it with the application context.
|
||||||
|
|
@ -38,8 +39,8 @@ public class NettyRSocketBootstrap
|
||||||
private ApplicationEventPublisher applicationEventPublisher;
|
private ApplicationEventPublisher applicationEventPublisher;
|
||||||
|
|
||||||
public NettyRSocketBootstrap(RSocketServerFactory serverFactoryProvider,
|
public NettyRSocketBootstrap(RSocketServerFactory serverFactoryProvider,
|
||||||
MessageHandlerAcceptor messageHandlerAcceptorProvider) {
|
SocketAcceptor socketAcceptor) {
|
||||||
this.rSocketServer = serverFactoryProvider.create(messageHandlerAcceptorProvider);
|
this.rSocketServer = serverFactoryProvider.create(socketAcceptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue