Package org.apache.camel.component.netty
Class NettyServerBootstrapConfiguration
- java.lang.Object
-
- org.apache.camel.component.netty.NettyServerBootstrapConfiguration
-
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
NettyConfiguration
@UriParams public class NettyServerBootstrapConfiguration extends Object implements Cloneable
-
-
Field Summary
Fields Modifier and Type Field Description protected intbacklogprotected intbossCountprotected io.netty.channel.EventLoopGroupbossGroupprotected booleanbroadcastprotected io.netty.channel.group.ChannelGroupchannelGroupprotected intconnectTimeoutstatic StringDEFAULT_ENABLED_PROTOCOLSprotected StringenabledProtocolsprotected Stringhostprotected booleankeepAliveprotected FilekeyStoreFileprotected StringkeyStoreFormatprotected StringkeyStoreResourceprotected booleannativeTransportprotected booleanneedClientAuthprotected NettyServerBootstrapFactorynettyServerBootstrapFactoryprotected StringnetworkInterfaceprotected Map<String,Object>optionsprotected Stringpassphraseprotected intportprotected Stringprotocolprotected intreceiveBufferSizeprotected intreceiveBufferSizePredictorprotected booleanreuseAddressprotected StringsecurityProviderprotected intsendBufferSizeprotected ServerInitializerFactoryserverInitializerFactoryprotected booleansslprotected booleansslClientCertHeadersprotected org.apache.camel.support.jsse.SSLContextParameterssslContextParametersprotected io.netty.handler.ssl.SslHandlersslHandlerprotected booleantcpNoDelayprotected FiletrustStoreFileprotected StringtrustStoreResourceprotected intworkerCountprotected io.netty.channel.EventLoopGroupworkerGroup
-
Constructor Summary
Constructors Constructor Description NettyServerBootstrapConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancompatible(NettyServerBootstrapConfiguration other)Checks if the otherNettyServerBootstrapConfigurationis compatible with this, as a Netty listener bound on port X shares the same commonNettyServerBootstrapConfiguration, which must be identical.StringgetAddress()intgetBacklog()intgetBossCount()io.netty.channel.EventLoopGroupgetBossGroup()io.netty.channel.group.ChannelGroupgetChannelGroup()intgetConnectTimeout()StringgetEnabledProtocols()StringgetHost()FilegetKeyStoreFile()Deprecated.StringgetKeyStoreFormat()StringgetKeyStoreResource()NettyServerBootstrapFactorygetNettyServerBootstrapFactory()StringgetNetworkInterface()Map<String,Object>getOptions()StringgetPassphrase()intgetPort()StringgetProtocol()intgetReceiveBufferSize()intgetReceiveBufferSizePredictor()intgetReconnectInterval()Used if reconnect and clientMode is enabled.StringgetSecurityProvider()intgetSendBufferSize()ServerInitializerFactorygetServerInitializerFactory()ServerInitializerFactorygetServerPipelineFactory()Deprecated.use #getServerInitializerFactoryorg.apache.camel.support.jsse.SSLContextParametersgetSslContextParameters()io.netty.handler.ssl.SslHandlergetSslHandler()FilegetTrustStoreFile()Deprecated.StringgetTrustStoreResource()intgetWorkerCount()io.netty.channel.EventLoopGroupgetWorkerGroup()booleanisBroadcast()booleanisKeepAlive()booleanisNativeTransport()booleanisNeedClientAuth()booleanisReconnect()Used only in clientMode in consumer, the consumer will attempt to reconnect on disconnection if this is enabledbooleanisReuseAddress()booleanisSsl()booleanisSslClientCertHeaders()booleanisTcp()booleanisTcpNoDelay()voidsetBacklog(int backlog)Allows to configure a backlog for netty consumer (server).voidsetBossCount(int bossCount)When netty works on nio mode, it uses default bossCount parameter from Netty, which is 1.voidsetBossGroup(io.netty.channel.EventLoopGroup bossGroup)Set the BossGroup which could be used for handling the new connection of the server side across the NettyEndpointvoidsetBroadcast(boolean broadcast)Setting to choose Multicast over UDPvoidsetChannelGroup(io.netty.channel.group.ChannelGroup channelGroup)To use a explicit ChannelGroup.voidsetConnectTimeout(int connectTimeout)Time to wait for a socket connection to be available.voidsetEnabledProtocols(String enabledProtocols)Which protocols to enable when using SSLvoidsetHost(String host)The hostname.voidsetKeepAlive(boolean keepAlive)Setting to ensure socket is not closed due to inactivityvoidsetKeyStoreFile(File keyStoreFile)Deprecated.voidsetKeyStoreFormat(String keyStoreFormat)Keystore format to be used for payload encryption.voidsetKeyStoreResource(String keyStoreResource)Client side certificate keystore to be used for encryption.voidsetNativeTransport(boolean nativeTransport)Whether to use native transport instead of NIO.voidsetNeedClientAuth(boolean needClientAuth)Configures whether the server needs client authentication when using SSL.voidsetNettyServerBootstrapFactory(NettyServerBootstrapFactory nettyServerBootstrapFactory)To use a custom NettyServerBootstrapFactoryvoidsetNetworkInterface(String networkInterface)When using UDP then this option can be used to specify a network interface by its name, such as eth0 to join a multicast group.voidsetOptions(Map<String,Object> options)Allows to configure additional netty options using "option." as prefix.voidsetPassphrase(String passphrase)Password setting to use in order to encrypt/decrypt payloads sent using SSHvoidsetPort(int port)The host port numbervoidsetProtocol(String protocol)The protocol to use which can be tcp or udp.voidsetReceiveBufferSize(int receiveBufferSize)The TCP/UDP buffer sizes to be used during inbound communication.voidsetReceiveBufferSizePredictor(int receiveBufferSizePredictor)Configures the buffer size predictor.voidsetReconnect(boolean reconnect)voidsetReconnectInterval(int reconnectInterval)voidsetReuseAddress(boolean reuseAddress)Setting to facilitate socket multiplexingvoidsetSecurityProvider(String securityProvider)Security provider to be used for payload encryption.voidsetSendBufferSize(int sendBufferSize)The TCP/UDP buffer sizes to be used during outbound communication.voidsetServerInitializerFactory(ServerInitializerFactory serverInitializerFactory)To use a custom ServerInitializerFactoryvoidsetServerPipelineFactory(ServerInitializerFactory serverPipelineFactory)Deprecated.use #setServerInitializerFactoryvoidsetSsl(boolean ssl)Setting to specify whether SSL encryption is applied to this endpointvoidsetSslClientCertHeaders(boolean sslClientCertHeaders)When enabled and in SSL mode, then the Netty consumer will enrich the Camel Message with headers having information about the client certificate such as subject name, issuer name, serial number, and the valid date range.voidsetSslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters)To configure security using SSLContextParametersvoidsetSslHandler(io.netty.handler.ssl.SslHandler sslHandler)Reference to a class that could be used to return an SSL HandlervoidsetTcpNoDelay(boolean tcpNoDelay)Setting to improve TCP protocol performancevoidsetTrustStoreFile(File trustStoreFile)Deprecated.voidsetTrustStoreResource(String trustStoreResource)Server side certificate keystore to be used for encryption.voidsetWorkerCount(int workerCount)When netty works on nio mode, it uses default workerCount parameter from Netty (which is cpu_core_threads x 2).voidsetWorkerGroup(io.netty.channel.EventLoopGroup workerGroup)To use a explicit EventLoopGroup as the boss thread pool.StringtoStringBootstrapConfiguration()
-
-
-
Field Detail
-
DEFAULT_ENABLED_PROTOCOLS
public static final String DEFAULT_ENABLED_PROTOCOLS
- See Also:
- Constant Field Values
-
protocol
@UriPath(enums="tcp,udp") @Metadata(required=true) protected String protocol
-
host
@UriPath @Metadata(required=true) protected String host
-
port
@UriPath @Metadata(required=true) protected int port
-
broadcast
@UriParam(label="consumer") protected boolean broadcast
-
sendBufferSize
@UriParam(label="advanced", defaultValue="65536") protected int sendBufferSize
-
receiveBufferSize
@UriParam(label="advanced", defaultValue="65536") protected int receiveBufferSize
-
receiveBufferSizePredictor
@UriParam(label="advanced") protected int receiveBufferSizePredictor
-
bossCount
@UriParam(label="consumer,advanced", defaultValue="1") protected int bossCount
-
workerCount
@UriParam(label="advanced") protected int workerCount
-
keepAlive
@UriParam(defaultValue="true") protected boolean keepAlive
-
tcpNoDelay
@UriParam(defaultValue="true") protected boolean tcpNoDelay
-
reuseAddress
@UriParam(defaultValue="true") protected boolean reuseAddress
-
connectTimeout
@UriParam(label="producer", defaultValue="10000") protected int connectTimeout
-
backlog
@UriParam(label="consumer,advanced") protected int backlog
-
serverInitializerFactory
@UriParam(label="consumer,advanced") protected ServerInitializerFactory serverInitializerFactory
-
nettyServerBootstrapFactory
@UriParam(label="consumer,advanced") protected NettyServerBootstrapFactory nettyServerBootstrapFactory
-
options
@UriParam(label="advanced", prefix="option.", multiValue=true) protected Map<String,Object> options
-
ssl
@UriParam(label="security") protected boolean ssl
-
sslClientCertHeaders
@UriParam(label="security") protected boolean sslClientCertHeaders
-
sslHandler
@UriParam(label="security") protected io.netty.handler.ssl.SslHandler sslHandler
-
sslContextParameters
@UriParam(label="security") protected org.apache.camel.support.jsse.SSLContextParameters sslContextParameters
-
needClientAuth
@UriParam(label="consumer,security") protected boolean needClientAuth
-
keyStoreFile
@UriParam(label="security") protected File keyStoreFile
-
trustStoreFile
@UriParam(label="security") protected File trustStoreFile
-
keyStoreResource
@UriParam(label="security") protected String keyStoreResource
-
trustStoreResource
@UriParam(label="security") protected String trustStoreResource
-
keyStoreFormat
@UriParam(label="security") protected String keyStoreFormat
-
securityProvider
@UriParam(label="security") protected String securityProvider
-
enabledProtocols
@UriParam(defaultValue="TLSv1,TLSv1.1,TLSv1.2", label="security") protected String enabledProtocols
-
passphrase
@UriParam(label="security", secret=true) protected String passphrase
-
nativeTransport
@UriParam(label="advanced") protected boolean nativeTransport
-
bossGroup
@UriParam(label="consumer,advanced") protected io.netty.channel.EventLoopGroup bossGroup
-
workerGroup
@UriParam(label="advanced") protected io.netty.channel.EventLoopGroup workerGroup
-
channelGroup
@UriParam(label="advanced") protected io.netty.channel.group.ChannelGroup channelGroup
-
networkInterface
@UriParam(label="consumer,advanced") protected String networkInterface
-
-
Method Detail
-
getAddress
public String getAddress()
-
isTcp
public boolean isTcp()
-
getProtocol
public String getProtocol()
-
setProtocol
public void setProtocol(String protocol)
The protocol to use which can be tcp or udp.
-
getHost
public String getHost()
-
setHost
public void setHost(String host)
The hostname. For the consumer the hostname is localhost or 0.0.0.0. For the producer the hostname is the remote host to connect to
-
getPort
public int getPort()
-
setPort
public void setPort(int port)
The host port number
-
isBroadcast
public boolean isBroadcast()
-
setBroadcast
public void setBroadcast(boolean broadcast)
Setting to choose Multicast over UDP
-
getSendBufferSize
public int getSendBufferSize()
-
setSendBufferSize
public void setSendBufferSize(int sendBufferSize)
The TCP/UDP buffer sizes to be used during outbound communication. Size is bytes.
-
getReceiveBufferSize
public int getReceiveBufferSize()
-
setReceiveBufferSize
public void setReceiveBufferSize(int receiveBufferSize)
The TCP/UDP buffer sizes to be used during inbound communication. Size is bytes.
-
getReceiveBufferSizePredictor
public int getReceiveBufferSizePredictor()
-
setReceiveBufferSizePredictor
public void setReceiveBufferSizePredictor(int receiveBufferSizePredictor)
Configures the buffer size predictor. See details at Jetty documentation and this mail thread.
-
getWorkerCount
public int getWorkerCount()
-
setWorkerCount
public void setWorkerCount(int workerCount)
When netty works on nio mode, it uses default workerCount parameter from Netty (which is cpu_core_threads x 2). User can use this option to override the default workerCount from Netty.
-
getBossCount
public int getBossCount()
-
setBossCount
public void setBossCount(int bossCount)
When netty works on nio mode, it uses default bossCount parameter from Netty, which is 1. User can use this option to override the default bossCount from Netty
-
isKeepAlive
public boolean isKeepAlive()
-
setKeepAlive
public void setKeepAlive(boolean keepAlive)
Setting to ensure socket is not closed due to inactivity
-
isTcpNoDelay
public boolean isTcpNoDelay()
-
setTcpNoDelay
public void setTcpNoDelay(boolean tcpNoDelay)
Setting to improve TCP protocol performance
-
isReuseAddress
public boolean isReuseAddress()
-
setReuseAddress
public void setReuseAddress(boolean reuseAddress)
Setting to facilitate socket multiplexing
-
getConnectTimeout
public int getConnectTimeout()
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout)
Time to wait for a socket connection to be available. Value is in milliseconds.
-
getBacklog
public int getBacklog()
-
setBacklog
public void setBacklog(int backlog)
Allows to configure a backlog for netty consumer (server). Note the backlog is just a best effort depending on the OS. Setting this option to a value such as 200, 500 or 1000, tells the TCP stack how long the "accept" queue can be If this option is not configured, then the backlog depends on OS setting.
-
isSsl
public boolean isSsl()
-
setSsl
public void setSsl(boolean ssl)
Setting to specify whether SSL encryption is applied to this endpoint
-
isSslClientCertHeaders
public boolean isSslClientCertHeaders()
-
setSslClientCertHeaders
public void setSslClientCertHeaders(boolean sslClientCertHeaders)
When enabled and in SSL mode, then the Netty consumer will enrich the Camel Message with headers having information about the client certificate such as subject name, issuer name, serial number, and the valid date range.
-
getSslHandler
public io.netty.handler.ssl.SslHandler getSslHandler()
-
setSslHandler
public void setSslHandler(io.netty.handler.ssl.SslHandler sslHandler)
Reference to a class that could be used to return an SSL Handler
-
getSslContextParameters
public org.apache.camel.support.jsse.SSLContextParameters getSslContextParameters()
-
setSslContextParameters
public void setSslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters)
To configure security using SSLContextParameters
-
isNeedClientAuth
public boolean isNeedClientAuth()
-
setNeedClientAuth
public void setNeedClientAuth(boolean needClientAuth)
Configures whether the server needs client authentication when using SSL.
-
getKeyStoreFile
@Deprecated public File getKeyStoreFile()
Deprecated.
-
setKeyStoreFile
@Deprecated public void setKeyStoreFile(File keyStoreFile)
Deprecated.Client side certificate keystore to be used for encryption
-
getTrustStoreFile
@Deprecated public File getTrustStoreFile()
Deprecated.
-
setTrustStoreFile
@Deprecated public void setTrustStoreFile(File trustStoreFile)
Deprecated.Server side certificate keystore to be used for encryption
-
getKeyStoreResource
public String getKeyStoreResource()
-
setKeyStoreResource
public void setKeyStoreResource(String keyStoreResource)
Client side certificate keystore to be used for encryption. Is loaded by default from classpath, but you can prefix with "classpath:", "file:", or "http:" to load the resource from different systems.
-
getTrustStoreResource
public String getTrustStoreResource()
-
setTrustStoreResource
public void setTrustStoreResource(String trustStoreResource)
Server side certificate keystore to be used for encryption. Is loaded by default from classpath, but you can prefix with "classpath:", "file:", or "http:" to load the resource from different systems.
-
getKeyStoreFormat
public String getKeyStoreFormat()
-
setKeyStoreFormat
public void setKeyStoreFormat(String keyStoreFormat)
Keystore format to be used for payload encryption. Defaults to "JKS" if not set
-
getSecurityProvider
public String getSecurityProvider()
-
setSecurityProvider
public void setSecurityProvider(String securityProvider)
Security provider to be used for payload encryption. Defaults to "SunX509" if not set.
-
getPassphrase
public String getPassphrase()
-
setPassphrase
public void setPassphrase(String passphrase)
Password setting to use in order to encrypt/decrypt payloads sent using SSH
-
getServerPipelineFactory
@Deprecated public ServerInitializerFactory getServerPipelineFactory()
Deprecated.use #getServerInitializerFactory
-
setServerPipelineFactory
@Deprecated public void setServerPipelineFactory(ServerInitializerFactory serverPipelineFactory)
Deprecated.use #setServerInitializerFactory
-
getServerInitializerFactory
public ServerInitializerFactory getServerInitializerFactory()
-
setServerInitializerFactory
public void setServerInitializerFactory(ServerInitializerFactory serverInitializerFactory)
To use a custom ServerInitializerFactory
-
getNettyServerBootstrapFactory
public NettyServerBootstrapFactory getNettyServerBootstrapFactory()
-
setNettyServerBootstrapFactory
public void setNettyServerBootstrapFactory(NettyServerBootstrapFactory nettyServerBootstrapFactory)
To use a custom NettyServerBootstrapFactory
-
setOptions
public void setOptions(Map<String,Object> options)
Allows to configure additional netty options using "option." as prefix. For example "option.child.keepAlive=false" to set the netty option "child.keepAlive=false". See the Netty documentation for possible options that can be used.
-
isNativeTransport
public boolean isNativeTransport()
-
setNativeTransport
public void setNativeTransport(boolean nativeTransport)
Whether to use native transport instead of NIO. Native transport takes advantage of the host operating system and is only supported on some platforms. You need to add the netty JAR for the host operating system you are using. See more details at: http://netty.io/wiki/native-transports.html
-
getBossGroup
public io.netty.channel.EventLoopGroup getBossGroup()
-
setBossGroup
public void setBossGroup(io.netty.channel.EventLoopGroup bossGroup)
Set the BossGroup which could be used for handling the new connection of the server side across the NettyEndpoint
-
getWorkerGroup
public io.netty.channel.EventLoopGroup getWorkerGroup()
-
setWorkerGroup
public void setWorkerGroup(io.netty.channel.EventLoopGroup workerGroup)
To use a explicit EventLoopGroup as the boss thread pool. For example to share a thread pool with multiple consumers or producers. By default each consumer or producer has their own worker pool with 2 x cpu count core threads.
-
getChannelGroup
public io.netty.channel.group.ChannelGroup getChannelGroup()
-
setChannelGroup
public void setChannelGroup(io.netty.channel.group.ChannelGroup channelGroup)
To use a explicit ChannelGroup.
-
getNetworkInterface
public String getNetworkInterface()
-
setNetworkInterface
public void setNetworkInterface(String networkInterface)
When using UDP then this option can be used to specify a network interface by its name, such as eth0 to join a multicast group.
-
getEnabledProtocols
public String getEnabledProtocols()
-
setEnabledProtocols
public void setEnabledProtocols(String enabledProtocols)
Which protocols to enable when using SSL
-
isReconnect
public boolean isReconnect()
Used only in clientMode in consumer, the consumer will attempt to reconnect on disconnection if this is enabled
-
setReconnect
public void setReconnect(boolean reconnect)
-
getReconnectInterval
public int getReconnectInterval()
Used if reconnect and clientMode is enabled. The interval in milli seconds to attempt reconnection
-
setReconnectInterval
public void setReconnectInterval(int reconnectInterval)
-
compatible
public boolean compatible(NettyServerBootstrapConfiguration other)
Checks if the otherNettyServerBootstrapConfigurationis compatible with this, as a Netty listener bound on port X shares the same commonNettyServerBootstrapConfiguration, which must be identical.
-
toStringBootstrapConfiguration
public String toStringBootstrapConfiguration()
-
-