public class ServerRSocketConnector extends AbstractRSocketConnector implements ApplicationEventPublisherAware
AbstractRSocketConnector
extension to accept and manage client RSocket connections.RSocketConnector
rSocketMessageHandler
DEFAULT_PHASE
Constructor and Description |
---|
ServerRSocketConnector(reactor.netty.http.server.HttpServer server)
Instantiate a server connector based on the
WebsocketServerTransport . |
ServerRSocketConnector(ServerRSocketMessageHandler serverRSocketMessageHandler)
Instantiate a server connector based on a provided
ServerRSocketMessageHandler
with an assumption that RSocket server is created externally as well. |
ServerRSocketConnector(io.rsocket.transport.ServerTransport<io.rsocket.transport.netty.server.CloseableChannel> serverTransport)
Instantiate a server connector based on the provided
ServerTransport . |
ServerRSocketConnector(String bindAddress,
int port)
Instantiate a server connector based on the
TcpServerTransport . |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
afterSingletonsInstantiated() |
void |
destroy() |
protected void |
doStart() |
reactor.core.publisher.Mono<Integer> |
getBoundPort()
Return the port this internal server is bound or empty
Mono . |
RSocketRequester |
getClientRSocketRequester(Object key)
Return connected
RSocketRequester mapped by key or null. |
Map<Object,RSocketRequester> |
getClientRSocketRequesters()
Return connected
RSocketRequester s mapped by keys. |
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) |
void |
setClientRSocketKeyStrategy(java.util.function.BiFunction<Map<String,Object>,DataBuffer,Object> clientRSocketKeyStrategy)
Configure a strategy to determine a key for the client
RSocketRequester connected. |
void |
setDataMimeType(MimeType dataMimeType)
Configure a
MimeType for data exchanging. |
void |
setMetadataMimeType(MimeType metadataMimeType)
Configure a
MimeType for metadata exchanging. |
void |
setRSocketStrategies(RSocketStrategies rsocketStrategies)
Configure a
RSocketStrategies for data encoding/decoding. |
void |
setServerConfigurer(java.util.function.Consumer<io.rsocket.core.RSocketServer> serverConfigurer)
Provide a
Consumer to configure the RSocketServer . |
addEndpoint, getDataMimeType, getMetadataMimeType, getRSocketStrategies, isAutoStartup, isRunning, setAutoStartup, setEndpoints, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPhase, stop
public ServerRSocketConnector(ServerRSocketMessageHandler serverRSocketMessageHandler)
ServerRSocketMessageHandler
with an assumption that RSocket server is created externally as well.
All other options are ignored in favor of provided ServerRSocketMessageHandler
and its external RSocket server configuration.serverRSocketMessageHandler
- the ServerRSocketMessageHandler
to rely on.public ServerRSocketConnector(String bindAddress, int port)
TcpServerTransport
.bindAddress
- the local address to bind TCP server onto.port
- the local TCP port to bind.ServerRSocketConnector(ServerTransport)
public ServerRSocketConnector(reactor.netty.http.server.HttpServer server)
WebsocketServerTransport
.server
- the HttpServer
to use.ServerRSocketConnector(ServerTransport)
public ServerRSocketConnector(io.rsocket.transport.ServerTransport<io.rsocket.transport.netty.server.CloseableChannel> serverTransport)
ServerTransport
.serverTransport
- the ServerTransport
to make server based on.public void setServerConfigurer(java.util.function.Consumer<io.rsocket.core.RSocketServer> serverConfigurer)
Consumer
to configure the RSocketServer
.serverConfigurer
- the Consumer
to configure the RSocketServer
.public void setClientRSocketKeyStrategy(java.util.function.BiFunction<Map<String,Object>,DataBuffer,Object> clientRSocketKeyStrategy)
RSocketRequester
connected.
Defaults to the destination
to which a client is connected.clientRSocketKeyStrategy
- the BiFunction
to determine a key for client RSocketRequester
s.public void setDataMimeType(@Nullable MimeType dataMimeType)
AbstractRSocketConnector
MimeType
for data exchanging.setDataMimeType
in class AbstractRSocketConnector
dataMimeType
- the MimeType
to use.public void setMetadataMimeType(MimeType metadataMimeType)
AbstractRSocketConnector
MimeType
for metadata exchanging.
Default to "message/x.rsocket.composite-metadata.v0"
.setMetadataMimeType
in class AbstractRSocketConnector
metadataMimeType
- the MimeType
to use.public void setRSocketStrategies(RSocketStrategies rsocketStrategies)
AbstractRSocketConnector
RSocketStrategies
for data encoding/decoding.setRSocketStrategies
in class AbstractRSocketConnector
rsocketStrategies
- the RSocketStrategies
to use.public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
setApplicationContext
in class AbstractRSocketConnector
BeansException
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher
in interface ApplicationEventPublisherAware
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class AbstractRSocketConnector
public Map<Object,RSocketRequester> getClientRSocketRequesters()
RSocketRequester
s mapped by keys.RSocketRequester
s mapped by keys.ServerRSocketMessageHandler.getClientRSocketRequesters()
@Nullable public RSocketRequester getClientRSocketRequester(Object key)
RSocketRequester
mapped by key or null.key
- the mapping key.RSocketRequester
or null.ServerRSocketMessageHandler.getClientRSocketRequester(Object)
public reactor.core.publisher.Mono<Integer> getBoundPort()
Mono
.Mono
if an external server is used.protected void doStart()
doStart
in class AbstractRSocketConnector
public void destroy()
destroy
in interface DisposableBean
public void afterSingletonsInstantiated()
afterSingletonsInstantiated
in interface SmartInitializingSingleton
afterSingletonsInstantiated
in class AbstractRSocketConnector