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 Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected io.netty.handler.ssl.SslContextprotected ApiGatewayprotected io.netty.channel.ChannelHandlerprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected booleanprotected intprotected intMaximum time (in SECONDS) a client may stay silent while the server is still waiting for (the rest of) an HTTP request.protected booleanprotected io.netty.channel.EventLoopGroupprotected TrustManagerFactoryprotected booleanprotected intprotected NettyWebSocketRegistryFields inherited from class services.moleculer.service.MoleculerComponent
broker, logger, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected io.netty.handler.ssl.SslHandlercreateSslHandler(io.netty.channel.Channel ch) io.netty.channel.ChannelHandlerintgetPort()intprotected io.netty.handler.ssl.SslContextio.netty.channel.EventLoopGroupintbooleanbooleanbooleanisUseSSL()voidsetAddress(String address) voidsetHandler(io.netty.channel.ChannelHandler handler) voidsetKeyCertChainFilePath(String keyCertChainFilePath) voidsetKeyFilePath(String keyFilePath) voidsetKeyStoreFilePath(String keyStoreFilePath) voidsetKeyStorePassword(String keyStorePassword) voidsetKeyStoreType(String keyStoreType) voidsetOpenSslSessionCacheEnabled(boolean openSslSessionCacheEnabled) voidsetPort(int port) voidsetReadTimeout(int readTimeout) Sets the read (reader-idle) timeout in SECONDS.voidsetShutDownThreadPools(boolean shutDownThreadPools) voidsetThreadGroup(io.netty.channel.EventLoopGroup singletonGroup) voidsetTrustManagerFactory(TrustManagerFactory trustManagerFactory) voidsetUseSSL(boolean useSSL) voidsetWebSocketCleanupSeconds(int webSocketCleanupSeconds) voidstarted(services.moleculer.ServiceBroker broker) voidstopped()Methods inherited from class services.moleculer.service.MoleculerComponent
getBroker, getLogger, getName
-
Field Details
-
gateway
-
port
protected int port -
address
-
threadGroup
protected io.netty.channel.EventLoopGroup threadGroup -
handler
protected io.netty.channel.ChannelHandler handler -
webSocketCleanupSeconds
protected int webSocketCleanupSeconds -
readTimeout
protected int readTimeoutMaximum 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 theNettyWebSocketRegistryinstead). -
shutDownThreadPools
protected boolean shutDownThreadPools -
useSSL
protected boolean useSSL -
trustManagerFactory
-
keyStoreFilePath
-
keyStorePassword
-
keyStoreType
-
keyCertChainFilePath
-
keyFilePath
-
openSslSessionCacheEnabled
protected boolean openSslSessionCacheEnabled -
cachedSslContext
protected io.netty.handler.ssl.SslContext cachedSslContext -
webSocketRegistry
-
-
Constructor Details
-
NettyServer
public NettyServer() -
NettyServer
public NettyServer(int port)
-
-
Method Details
-
started
-
stopped
public void stopped()- Specified by:
stoppedin interfaceservices.moleculer.service.MoleculerLifecycle- Overrides:
stoppedin classservices.moleculer.service.MoleculerComponent
-
createSslHandler
-
getSslContext
-
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
-
setTrustManagerFactory
-
getKeyStoreFilePath
-
setKeyStoreFilePath
-
getKeyStorePassword
-
setKeyStorePassword
-
getKeyStoreType
-
setKeyStoreType
-
getKeyCertChainFilePath
-
setKeyCertChainFilePath
-
getKeyFilePath
-
setKeyFilePath
-
isOpenSslSessionCacheEnabled
public boolean isOpenSslSessionCacheEnabled() -
setOpenSslSessionCacheEnabled
public void setOpenSslSessionCacheEnabled(boolean openSslSessionCacheEnabled) -
getAddress
-
setAddress
-
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)
-