Class ServerRSocketConnector

java.lang.Object
org.springframework.integration.rsocket.AbstractRSocketConnector
org.springframework.integration.rsocket.ServerRSocketConnector
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.SmartInitializingSingleton, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

public class ServerRSocketConnector extends AbstractRSocketConnector implements org.springframework.context.ApplicationEventPublisherAware
A server AbstractRSocketConnector extension to accept and manage client RSocket connections.
Since:
5.2
See Also:
  • RSocketConnector
  • Constructor Details

    • ServerRSocketConnector

      public ServerRSocketConnector(ServerRSocketMessageHandler serverRSocketMessageHandler)
      Instantiate a server connector based on a provided 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.
      Parameters:
      serverRSocketMessageHandler - the ServerRSocketMessageHandler to rely on.
      Since:
      5.2.1
    • ServerRSocketConnector

      public ServerRSocketConnector(String bindAddress, int port)
      Instantiate a server connector based on the TcpServerTransport.
      Parameters:
      bindAddress - the local address to bind TCP server onto.
      port - the local TCP port to bind.
      See Also:
    • ServerRSocketConnector

      public ServerRSocketConnector(reactor.netty.http.server.HttpServer server)
      Instantiate a server connector based on the WebsocketServerTransport.
      Parameters:
      server - the HttpServer to use.
      See Also:
    • ServerRSocketConnector

      public ServerRSocketConnector(io.rsocket.transport.ServerTransport<io.rsocket.transport.netty.server.CloseableChannel> serverTransport)
      Instantiate a server connector based on the provided ServerTransport.
      Parameters:
      serverTransport - the ServerTransport to make server based on.
  • Method Details

    • setServerConfigurer

      public void setServerConfigurer(Consumer<io.rsocket.core.RSocketServer> serverConfigurer)
      Provide a Consumer to configure the RSocketServer.
      Parameters:
      serverConfigurer - the Consumer to configure the RSocketServer.
      Since:
      5.2.6
    • setClientRSocketKeyStrategy

      public void setClientRSocketKeyStrategy(BiFunction<Map<String,Object>,org.springframework.core.io.buffer.DataBuffer,Object> clientRSocketKeyStrategy)
      Configure a strategy to determine a key for the client RSocketRequester connected. Defaults to the destination to which a client is connected.
      Parameters:
      clientRSocketKeyStrategy - the BiFunction to determine a key for client RSocketRequesters.
    • setDataMimeType

      public void setDataMimeType(@Nullable org.springframework.util.MimeType dataMimeType)
      Description copied from class: AbstractRSocketConnector
      Configure a MimeType for data exchanging.
      Overrides:
      setDataMimeType in class AbstractRSocketConnector
      Parameters:
      dataMimeType - the MimeType to use.
    • setMetadataMimeType

      public void setMetadataMimeType(org.springframework.util.MimeType metadataMimeType)
      Description copied from class: AbstractRSocketConnector
      Configure a MimeType for metadata exchanging. Default to "message/x.rsocket.composite-metadata.v0".
      Overrides:
      setMetadataMimeType in class AbstractRSocketConnector
      Parameters:
      metadataMimeType - the MimeType to use.
    • setRSocketStrategies

      public void setRSocketStrategies(org.springframework.messaging.rsocket.RSocketStrategies rsocketStrategies)
      Description copied from class: AbstractRSocketConnector
      Configure a RSocketStrategies for data encoding/decoding.
      Overrides:
      setRSocketStrategies in class AbstractRSocketConnector
      Parameters:
      rsocketStrategies - the RSocketStrategies to use.
    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Overrides:
      setApplicationContext in class AbstractRSocketConnector
      Throws:
      org.springframework.beans.BeansException
    • setApplicationEventPublisher

      public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
      Specified by:
      setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Overrides:
      afterPropertiesSet in class AbstractRSocketConnector
    • getClientRSocketRequesters

      public Map<Object,org.springframework.messaging.rsocket.RSocketRequester> getClientRSocketRequesters()
      Return connected RSocketRequesters mapped by keys.
      Returns:
      connected RSocketRequesters mapped by keys.
      See Also:
    • getClientRSocketRequester

      @Nullable public org.springframework.messaging.rsocket.RSocketRequester getClientRSocketRequester(Object key)
      Return connected RSocketRequester mapped by key or null.
      Parameters:
      key - the mapping key.
      Returns:
      the RSocketRequester or null.
      See Also:
    • getBoundPort

      public reactor.core.publisher.Mono<Integer> getBoundPort()
      Return the port this internal server is bound or empty Mono.
      Returns:
      the port this internal server is bound or empty Mono if an external server is used.
    • doStart

      protected void doStart()
      Specified by:
      doStart in class AbstractRSocketConnector
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
    • afterSingletonsInstantiated

      public void afterSingletonsInstantiated()
      Specified by:
      afterSingletonsInstantiated in interface org.springframework.beans.factory.SmartInitializingSingleton
      Overrides:
      afterSingletonsInstantiated in class AbstractRSocketConnector