Class NettyServer

java.lang.Object
services.moleculer.service.MoleculerComponent
services.moleculer.service.Service
services.moleculer.web.netty.NettyServer
All Implemented Interfaces:
services.moleculer.service.MoleculerLifecycle

public class NettyServer extends services.moleculer.service.Service
  • Field Details

    • gateway

      protected ApiGateway gateway
    • port

      protected int port
    • address

      protected String address
    • threadGroup

      protected io.netty.channel.EventLoopGroup threadGroup
    • handler

      protected io.netty.channel.ChannelHandler handler
    • webSocketCleanupSeconds

      protected int webSocketCleanupSeconds
    • readTimeout

      protected int readTimeout
      Maximum time (in SECONDS) a client may stay silent while the server is still waiting for (the rest of) an HTTP request. When no inbound data arrives within this period the connection is closed. This defends against Slowloris-style attacks that open many connections and send incomplete requests (half a header block or half a body) to exhaust file descriptors and memory. 0 = disabled (default, no behaviour change). The timer is removed once a connection is upgraded to a WebSocket (long-lived idle WebSockets are handled by the NettyWebSocketRegistry instead).
    • shutDownThreadPools

      protected boolean shutDownThreadPools
    • useSSL

      protected boolean useSSL
    • trustManagerFactory

      protected TrustManagerFactory trustManagerFactory
    • keyStoreFilePath

      protected String keyStoreFilePath
    • keyStorePassword

      protected String keyStorePassword
    • keyStoreType

      protected String keyStoreType
    • keyCertChainFilePath

      protected String keyCertChainFilePath
    • keyFilePath

      protected String keyFilePath
    • openSslSessionCacheEnabled

      protected boolean openSslSessionCacheEnabled
    • cachedSslContext

      protected io.netty.handler.ssl.SslContext cachedSslContext
    • webSocketRegistry

      protected NettyWebSocketRegistry webSocketRegistry
  • Constructor Details

    • NettyServer

      public NettyServer()
    • NettyServer

      public NettyServer(int port)
  • Method Details

    • started

      public void started(services.moleculer.ServiceBroker broker) throws Exception
      Specified by:
      started in interface services.moleculer.service.MoleculerLifecycle
      Overrides:
      started in class services.moleculer.service.MoleculerComponent
      Throws:
      Exception
    • stopped

      public void stopped()
      Specified by:
      stopped in interface services.moleculer.service.MoleculerLifecycle
      Overrides:
      stopped in class services.moleculer.service.MoleculerComponent
    • createSslHandler

      protected io.netty.handler.ssl.SslHandler createSslHandler(io.netty.channel.Channel ch) throws Exception
      Throws:
      Exception
    • getSslContext

      protected io.netty.handler.ssl.SslContext getSslContext() throws Exception
      Throws:
      Exception
    • getWebSocketCleanupSeconds

      public int getWebSocketCleanupSeconds()
    • setWebSocketCleanupSeconds

      public void setWebSocketCleanupSeconds(int webSocketCleanupSeconds)
    • getReadTimeout

      public int getReadTimeout()
    • setReadTimeout

      public void setReadTimeout(int readTimeout)
      Sets the read (reader-idle) timeout in SECONDS. When a client opens a connection but does not finish sending its request within this period of silence, the connection is closed. Set a small value (e.g. 30-60) on Internet-facing standalone deployments to mitigate Slowloris-style DoS; 0 disables the timeout (default).
      Parameters:
      readTimeout - read timeout in seconds (0 = disabled)
    • getPort

      public int getPort()
    • setPort

      public void setPort(int port)
    • isUseSSL

      public boolean isUseSSL()
    • setUseSSL

      public void setUseSSL(boolean useSSL)
    • getTrustManagerFactory

      public TrustManagerFactory getTrustManagerFactory()
    • setTrustManagerFactory

      public void setTrustManagerFactory(TrustManagerFactory trustManagerFactory)
    • getKeyStoreFilePath

      public String getKeyStoreFilePath()
    • setKeyStoreFilePath

      public void setKeyStoreFilePath(String keyStoreFilePath)
    • getKeyStorePassword

      public String getKeyStorePassword()
    • setKeyStorePassword

      public void setKeyStorePassword(String keyStorePassword)
    • getKeyStoreType

      public String getKeyStoreType()
    • setKeyStoreType

      public void setKeyStoreType(String keyStoreType)
    • getKeyCertChainFilePath

      public String getKeyCertChainFilePath()
    • setKeyCertChainFilePath

      public void setKeyCertChainFilePath(String keyCertChainFilePath)
    • getKeyFilePath

      public String getKeyFilePath()
    • setKeyFilePath

      public void setKeyFilePath(String keyFilePath)
    • isOpenSslSessionCacheEnabled

      public boolean isOpenSslSessionCacheEnabled()
    • setOpenSslSessionCacheEnabled

      public void setOpenSslSessionCacheEnabled(boolean openSslSessionCacheEnabled)
    • getAddress

      public String getAddress()
    • setAddress

      public void setAddress(String address)
    • getThreadGroup

      public io.netty.channel.EventLoopGroup getThreadGroup()
    • setThreadGroup

      public void setThreadGroup(io.netty.channel.EventLoopGroup singletonGroup)
    • getHandler

      public io.netty.channel.ChannelHandler getHandler()
    • setHandler

      public void setHandler(io.netty.channel.ChannelHandler handler)
    • isShutDownThreadPools

      public boolean isShutDownThreadPools()
    • setShutDownThreadPools

      public void setShutDownThreadPools(boolean shutDownThreadPools)