Class ServerRSocketConnector
java.lang.Object
org.springframework.integration.rsocket.AbstractRSocketConnector
org.springframework.integration.rsocket.ServerRSocketConnector
- All Implemented Interfaces:
- Aware,- DisposableBean,- InitializingBean,- SmartInitializingSingleton,- ApplicationContextAware,- ApplicationEventPublisherAware,- Lifecycle,- Phased,- SmartLifecycle
public class ServerRSocketConnector
extends AbstractRSocketConnector
implements ApplicationEventPublisherAware
A server 
AbstractRSocketConnector extension to accept and manage client RSocket connections.- Since:
- 5.2
- Author:
- Artem Bilan
- See Also:
- 
Field SummaryFields inherited from class org.springframework.integration.rsocket.AbstractRSocketConnectorrSocketMessageHandlerFields inherited from interface org.springframework.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructorsConstructorDescriptionServerRSocketConnector(io.rsocket.transport.ServerTransport<io.rsocket.transport.netty.server.CloseableChannel> serverTransport) Instantiate a server connector based on the providedServerTransport.ServerRSocketConnector(String bindAddress, int port) Instantiate a server connector based on theTcpServerTransport.ServerRSocketConnector(ServerRSocketMessageHandler serverRSocketMessageHandler) Instantiate a server connector based on a providedServerRSocketMessageHandlerwith an assumption that RSocket server is created externally as well.ServerRSocketConnector(reactor.netty.http.server.HttpServer server) Instantiate a server connector based on theWebsocketServerTransport.
- 
Method SummaryModifier and TypeMethodDescriptionvoidvoidvoiddestroy()protected voiddoStart()reactor.core.publisher.Mono<Integer> Return the port this internal server is bound or emptyMono.Return connectedRSocketRequestermapped by key or null.Return connectedRSocketRequesters mapped by keys.voidsetApplicationContext(ApplicationContext applicationContext) voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) voidsetClientRSocketKeyStrategy(BiFunction<Map<String, Object>, DataBuffer, Object> clientRSocketKeyStrategy) Configure a strategy to determine a key for the clientRSocketRequesterconnected.voidsetDataMimeType(MimeType dataMimeType) Configure aMimeTypefor data exchanging.voidsetMetadataMimeType(MimeType metadataMimeType) Configure aMimeTypefor metadata exchanging.voidsetRSocketStrategies(RSocketStrategies rsocketStrategies) Configure aRSocketStrategiesfor data encoding/decoding.voidsetServerConfigurer(Consumer<io.rsocket.core.RSocketServer> serverConfigurer) Provide aConsumerto configure theRSocketServer.Methods inherited from class org.springframework.integration.rsocket.AbstractRSocketConnectoraddEndpoint, getDataMimeType, getMetadataMimeType, getRSocketStrategies, isAutoStartup, isRunning, setAutoStartup, setEndpoints, start, stopMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecyclegetPhase, stop
- 
Constructor Details- 
ServerRSocketConnectorInstantiate a server connector based on a providedServerRSocketMessageHandlerwith an assumption that RSocket server is created externally as well. All other options are ignored in favor of providedServerRSocketMessageHandlerand its external RSocket server configuration.- Parameters:
- serverRSocketMessageHandler- the- ServerRSocketMessageHandlerto rely on.
- Since:
- 5.2.1
 
- 
ServerRSocketConnectorInstantiate a server connector based on theTcpServerTransport.- Parameters:
- bindAddress- the local address to bind TCP server onto.
- port- the local TCP port to bind.
- See Also:
 
- 
ServerRSocketConnectorpublic ServerRSocketConnector(reactor.netty.http.server.HttpServer server) Instantiate a server connector based on theWebsocketServerTransport.- Parameters:
- server- the- HttpServerto use.
- See Also:
 
- 
ServerRSocketConnectorpublic ServerRSocketConnector(io.rsocket.transport.ServerTransport<io.rsocket.transport.netty.server.CloseableChannel> serverTransport) Instantiate a server connector based on the providedServerTransport.- Parameters:
- serverTransport- the- ServerTransportto make server based on.
 
 
- 
- 
Method Details- 
setServerConfigurer
- 
setClientRSocketKeyStrategypublic void setClientRSocketKeyStrategy(BiFunction<Map<String, Object>, DataBuffer, Object> clientRSocketKeyStrategy) Configure a strategy to determine a key for the clientRSocketRequesterconnected. Defaults to thedestinationto which a client is connected.- Parameters:
- clientRSocketKeyStrategy- the- BiFunctionto determine a key for client- RSocketRequesters.
 
- 
setDataMimeTypeDescription copied from class:AbstractRSocketConnectorConfigure aMimeTypefor data exchanging.- Overrides:
- setDataMimeTypein class- AbstractRSocketConnector
- Parameters:
- dataMimeType- the- MimeTypeto use.
 
- 
setMetadataMimeTypeDescription copied from class:AbstractRSocketConnectorConfigure aMimeTypefor metadata exchanging. Default to"message/x.rsocket.composite-metadata.v0".- Overrides:
- setMetadataMimeTypein class- AbstractRSocketConnector
- Parameters:
- metadataMimeType- the- MimeTypeto use.
 
- 
setRSocketStrategiesDescription copied from class:AbstractRSocketConnectorConfigure aRSocketStrategiesfor data encoding/decoding.- Overrides:
- setRSocketStrategiesin class- AbstractRSocketConnector
- Parameters:
- rsocketStrategies- the- RSocketStrategiesto use.
 
- 
setApplicationContext- Specified by:
- setApplicationContextin interface- ApplicationContextAware
- Overrides:
- setApplicationContextin class- AbstractRSocketConnector
- Throws:
- BeansException
 
- 
setApplicationEventPublisher- Specified by:
- setApplicationEventPublisherin interface- ApplicationEventPublisherAware
 
- 
afterPropertiesSetpublic void afterPropertiesSet()- Specified by:
- afterPropertiesSetin interface- InitializingBean
- Overrides:
- afterPropertiesSetin class- AbstractRSocketConnector
 
- 
getClientRSocketRequestersReturn connectedRSocketRequesters mapped by keys.- Returns:
- connected RSocketRequesters mapped by keys.
- See Also:
 
- 
getClientRSocketRequesterReturn connectedRSocketRequestermapped by key or null.- Parameters:
- key- the mapping key.
- Returns:
- the RSocketRequesteror null.
- See Also:
 
- 
getBoundPortReturn the port this internal server is bound or emptyMono.- Returns:
- the port this internal server is bound or empty Monoif an external server is used.
 
- 
doStartprotected void doStart()- Specified by:
- doStartin class- AbstractRSocketConnector
 
- 
destroypublic void destroy()- Specified by:
- destroyin interface- DisposableBean
 
- 
afterSingletonsInstantiatedpublic void afterSingletonsInstantiated()- Specified by:
- afterSingletonsInstantiatedin interface- SmartInitializingSingleton
- Overrides:
- afterSingletonsInstantiatedin class- AbstractRSocketConnector
 
 
-