Repository: camel Updated Branches: refs/heads/master 50476075b -> c03292d9b
Component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c03292d9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c03292d9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c03292d9 Branch: refs/heads/master Commit: c03292d9bb021a7171ca81380ff282b2552aadbc Parents: 5047607 Author: Claus Ibsen <davscl...@apache.org> Authored: Thu May 21 09:51:56 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu May 21 10:02:29 2015 +0200 ---------------------------------------------------------------------- .../camel/component/netty/NettyComponent.java | 8 + .../component/netty/NettyConfiguration.java | 149 ++++++++++++++++--- .../NettyServerBootstrapConfiguration.java | 133 +++++++++++++++-- 3 files changed, 262 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/c03292d9/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java index 3613fa6..9565000 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java @@ -92,6 +92,9 @@ public class NettyComponent extends UriEndpointComponent { return configuration; } + /** + * To use the NettyConfiguration as configuration when creating endpoints. + */ public void setConfiguration(NettyConfiguration configuration) { this.configuration = configuration; } @@ -100,6 +103,11 @@ public class NettyComponent extends UriEndpointComponent { return maximumPoolSize; } + /** + * The core pool size for the ordered thread pool, if its in use. + * <p/> + * The default value is 16. + */ public void setMaximumPoolSize(int maximumPoolSize) { this.maximumPoolSize = maximumPoolSize; } http://git-wip-us.apache.org/repos/asf/camel/blob/c03292d9/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java index ca06845..5a148c0 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java @@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory; public class NettyConfiguration extends NettyServerBootstrapConfiguration implements Cloneable { private static final Logger LOG = LoggerFactory.getLogger(NettyConfiguration.class); - @UriParam + @UriParam(label = "producer") private long requestTimeout; @UriParam(defaultValue = "true") private boolean sync = true; @@ -60,45 +60,45 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem private List<ChannelHandler> decoders = new ArrayList<ChannelHandler>(); @UriParam private boolean disconnect; - @UriParam(defaultValue = "true") + @UriParam(label = "producer", defaultValue = "true") private boolean lazyChannelCreation = true; @UriParam private boolean transferExchange; - @UriParam(defaultValue = "true") + @UriParam(label = "consumer", defaultValue = "true") private boolean disconnectOnNoReply = true; - @UriParam(defaultValue = "WARN") + @UriParam(label = "consumer", defaultValue = "WARN") private LoggingLevel noReplyLogLevel = LoggingLevel.WARN; - @UriParam(defaultValue = "WARN") + @UriParam(label = "consumer", defaultValue = "WARN") private LoggingLevel serverExceptionCaughtLogLevel = LoggingLevel.WARN; - @UriParam(defaultValue = "DEBUG") + @UriParam(label = "consumer", defaultValue = "DEBUG") private LoggingLevel serverClosedChannelExceptionCaughtLogLevel = LoggingLevel.DEBUG; @UriParam(defaultValue = "true") private boolean allowDefaultCodec = true; - @UriParam + @UriParam(label = "producer") private ClientPipelineFactory clientPipelineFactory; //CAMEL-8031 Moved this option to NettyComponent private int maximumPoolSize = 16; - @UriParam(defaultValue = "true") + @UriParam(label = "consumer", defaultValue = "true") private boolean orderedThreadPoolExecutor = true; - @UriParam(defaultValue = "-1") + @UriParam(label = "producer", defaultValue = "-1") private int producerPoolMaxActive = -1; - @UriParam + @UriParam(label = "producer") private int producerPoolMinIdle; - @UriParam(defaultValue = "100") + @UriParam(label = "producer", defaultValue = "100") private int producerPoolMaxIdle = 100; - @UriParam(defaultValue = "" + 5 * 60 * 1000L) + @UriParam(label = "producer", defaultValue = "" + 5 * 60 * 1000L) private long producerPoolMinEvictableIdle = 5 * 60 * 1000L; - @UriParam(defaultValue = "true") + @UriParam(label = "producer", defaultValue = "true") private boolean producerPoolEnabled = true; - @UriParam + @UriParam(label = "producer") private boolean udpConnectionlessSending; - @UriParam + @UriParam(label = "consumer") private boolean clientMode; - @UriParam + @UriParam(label = "producer") private boolean useChannelBuffer; - @UriParam(defaultValue = "" + 10 * 1024 * 1024L) + @UriParam(label = "consumer", defaultValue = "" + 10 * 1024 * 1024L) private long maxChannelMemorySize = 10 * 1024 * 1024L; - @UriParam(defaultValue = "" + 200 * 1024 * 1024L) + @UriParam(label = "consumer", defaultValue = "" + 200 * 1024 * 1024L) private long maxTotalMemorySize = 200 * 1024 * 1024L; /** @@ -240,6 +240,11 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return requestTimeout; } + /** + * Allows to use a timeout for the Netty producer when calling a remote server. + * By default no timeout is in use. The value is in milli seconds, so eg 30000 is 30 seconds. + * The requestTimeout is using Netty's ReadTimeoutHandler to trigger the timeout. + */ public void setRequestTimeout(long requestTimeout) { this.requestTimeout = requestTimeout; } @@ -248,6 +253,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return sync; } + /** + * Setting to set endpoint as one-way or request-response + */ public void setSync(boolean sync) { this.sync = sync; } @@ -256,6 +264,10 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return textline; } + /** + * Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; + * if not specified or the value is false, then Object Serialization is assumed over TCP. + */ public void setTextline(boolean textline) { this.textline = textline; } @@ -264,6 +276,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return decoderMaxLineLength; } + /** + * The max line length to use for the textline codec. + */ public void setDecoderMaxLineLength(int decoderMaxLineLength) { this.decoderMaxLineLength = decoderMaxLineLength; } @@ -272,6 +287,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return delimiter; } + /** + * The delimiter to use for the textline codec. Possible values are LINE and NULL. + */ public void setDelimiter(TextLineDelimiter delimiter) { this.delimiter = delimiter; } @@ -280,6 +298,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return autoAppendDelimiter; } + /** + * Whether or not to auto append missing end delimiter when sending using the textline codec. + */ public void setAutoAppendDelimiter(boolean autoAppendDelimiter) { this.autoAppendDelimiter = autoAppendDelimiter; } @@ -288,6 +309,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return encoding; } + /** + * The encoding (a charset name) to use for the textline codec. If not provided, Camel will use the JVM default Charset. + */ public void setEncoding(String encoding) { this.encoding = encoding; } @@ -296,6 +320,11 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return decoders; } + /** + * A list of decoders to be used. + * You can use a String which have values separated by comma, and have the values be looked up in the Registry. + * Just remember to prefix the value with # so Camel knows it should lookup. + */ public void setDecoders(List<ChannelHandler> decoders) { this.decoders = decoders; } @@ -304,6 +333,10 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return encoders; } + /** + * A list of encoders to be used. You can use a String which have values separated by comma, and have the values be looked up in the Registry. + * Just remember to prefix the value with # so Camel knows it should lookup. + */ public void setEncoders(List<ChannelHandler> encoders) { this.encoders = encoders; } @@ -312,6 +345,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return encoders.isEmpty() ? null : encoders.get(0); } + /** + * A custom ChannelHandler class that can be used to perform special marshalling of outbound payloads. Must override org.jboss.netty.channel.ChannelDownStreamHandler. + */ public void setEncoder(ChannelHandler encoder) { if (!encoders.contains(encoder)) { encoders.add(encoder); @@ -322,6 +358,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return decoders.isEmpty() ? null : decoders.get(0); } + /** + * A custom ChannelHandler class that can be used to perform special marshalling of inbound payloads. Must override org.jboss.netty.channel.ChannelUpStreamHandler. + */ public void setDecoder(ChannelHandler decoder) { if (!decoders.contains(decoder)) { decoders.add(decoder); @@ -332,6 +371,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return disconnect; } + /** + * Whether or not to disconnect(close) from Netty Channel right after use. Can be used for both consumer and producer. + */ public void setDisconnect(boolean disconnect) { this.disconnect = disconnect; } @@ -340,6 +382,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return lazyChannelCreation; } + /** + * Channels can be lazily created to avoid exceptions, if the remote server is not up and running when the Camel producer is started. + */ public void setLazyChannelCreation(boolean lazyChannelCreation) { this.lazyChannelCreation = lazyChannelCreation; } @@ -348,6 +393,12 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return transferExchange; } + /** + * Only used for TCP. You can transfer the exchange over the wire instead of just the body. + * The following fields are transferred: In body, Out body, fault body, In headers, Out headers, fault headers, + * exchange properties, exchange exception. + * This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. + */ public void setTransferExchange(boolean transferExchange) { this.transferExchange = transferExchange; } @@ -356,6 +407,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return disconnectOnNoReply; } + /** + * If sync is enabled then this option dictates NettyConsumer if it should disconnect where there is no reply to send back. + */ public void setDisconnectOnNoReply(boolean disconnectOnNoReply) { this.disconnectOnNoReply = disconnectOnNoReply; } @@ -364,6 +418,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return noReplyLogLevel; } + /** + * If sync is enabled this option dictates NettyConsumer which logging level to use when logging a there is no reply to send back. + */ public void setNoReplyLogLevel(LoggingLevel noReplyLogLevel) { this.noReplyLogLevel = noReplyLogLevel; } @@ -372,6 +429,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return serverExceptionCaughtLogLevel; } + /** + * If the server (NettyConsumer) catches an exception then its logged using this logging level. + */ public void setServerExceptionCaughtLogLevel(LoggingLevel serverExceptionCaughtLogLevel) { this.serverExceptionCaughtLogLevel = serverExceptionCaughtLogLevel; } @@ -380,6 +440,10 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return serverClosedChannelExceptionCaughtLogLevel; } + /** + * If the server (NettyConsumer) catches an java.nio.channels.ClosedChannelException then its logged using this logging level. + * This is used to avoid logging the closed channel exceptions, as clients can disconnect abruptly and then cause a flood of closed exceptions in the Netty server. + */ public void setServerClosedChannelExceptionCaughtLogLevel(LoggingLevel serverClosedChannelExceptionCaughtLogLevel) { this.serverClosedChannelExceptionCaughtLogLevel = serverClosedChannelExceptionCaughtLogLevel; } @@ -388,10 +452,17 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return allowDefaultCodec; } + /** + * The netty component installs a default codec if both, encoder/deocder is null and textline is false. + * Setting allowDefaultCodec to false prevents the netty component from installing a default codec as the first element in the filter chain. + */ public void setAllowDefaultCodec(boolean allowDefaultCodec) { this.allowDefaultCodec = allowDefaultCodec; } + /** + * To use a custom ClientPipelineFactory + */ public void setClientPipelineFactory(ClientPipelineFactory clientPipelineFactory) { this.clientPipelineFactory = clientPipelineFactory; } @@ -400,6 +471,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return clientPipelineFactory; } + /** + * The core pool size for the ordered thread pool, if its in use. + */ public int getMaximumPoolSize() { return maximumPoolSize; } @@ -412,6 +486,10 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return orderedThreadPoolExecutor; } + /** + * Whether to use ordered thread pool, to ensure events are processed orderly on the same channel. + * See details at the netty javadoc of org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor for more details. + */ public void setOrderedThreadPoolExecutor(boolean orderedThreadPoolExecutor) { this.orderedThreadPoolExecutor = orderedThreadPoolExecutor; } @@ -420,6 +498,10 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return producerPoolMaxActive; } + /** + * Sets the cap on the number of objects that can be allocated by the pool + * (checked out to clients, or idle awaiting checkout) at a given time. Use a negative value for no limit. + */ public void setProducerPoolMaxActive(int producerPoolMaxActive) { this.producerPoolMaxActive = producerPoolMaxActive; } @@ -428,6 +510,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return producerPoolMinIdle; } + /** + * Sets the minimum number of instances allowed in the producer pool before the evictor thread (if active) spawns new objects. + */ public void setProducerPoolMinIdle(int producerPoolMinIdle) { this.producerPoolMinIdle = producerPoolMinIdle; } @@ -436,6 +521,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return producerPoolMaxIdle; } + /** + * Sets the cap on the number of "idle" instances in the pool. + */ public void setProducerPoolMaxIdle(int producerPoolMaxIdle) { this.producerPoolMaxIdle = producerPoolMaxIdle; } @@ -444,6 +532,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return producerPoolMinEvictableIdle; } + /** + * Sets the minimum amount of time (value in millis) an object may sit idle in the pool before it is eligible for eviction by the idle object evictor. + */ public void setProducerPoolMinEvictableIdle(long producerPoolMinEvictableIdle) { this.producerPoolMinEvictableIdle = producerPoolMinEvictableIdle; } @@ -452,6 +543,10 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return producerPoolEnabled; } + /** + * Whether producer pool is enabled or not. + * Important: Do not turn this off, as the pooling is needed for handling concurrency and reliable request/reply. + */ public void setProducerPoolEnabled(boolean producerPoolEnabled) { this.producerPoolEnabled = producerPoolEnabled; } @@ -460,6 +555,10 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return udpConnectionlessSending; } + /** + * This option supports connection less udp sending which is a real fire and forget. + * A connected udp send receive the PortUnreachableException if no one is listen on the receiving port. + */ public void setUdpConnectionlessSending(boolean udpConnectionlessSending) { this.udpConnectionlessSending = udpConnectionlessSending; } @@ -468,6 +567,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return clientMode; } + /** + * If the clientMode is true, netty consumer will connect the address as a TCP client. + */ public void setClientMode(boolean clientMode) { this.clientMode = clientMode; } @@ -476,6 +578,9 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return useChannelBuffer; } + /** + * If the useChannelBuffer is true, netty producer will turn the message body into {@link ChannelBuffer} before sending it out. + */ public void setUseChannelBuffer(boolean useChannelBuffer) { this.useChannelBuffer = useChannelBuffer; } @@ -484,6 +589,10 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return maxChannelMemorySize; } + /** + * The maximum total size of the queued events per channel when using orderedThreadPoolExecutor. + * Specify 0 to disable. + */ public void setMaxChannelMemorySize(long maxChannelMemorySize) { this.maxChannelMemorySize = maxChannelMemorySize; } @@ -492,6 +601,10 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem return maxTotalMemorySize; } + /** + * The maximum total size of the queued events for this pool when using orderedThreadPoolExecutor. + * Specify 0 to disable. + */ public void setMaxTotalMemorySize(long maxTotalMemorySize) { this.maxTotalMemorySize = maxTotalMemorySize; } http://git-wip-us.apache.org/repos/asf/camel/blob/c03292d9/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java index 20683b8..9832192 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java @@ -33,13 +33,13 @@ public class NettyServerBootstrapConfiguration implements Cloneable { public static final String DEFAULT_ENABLED_PROTOCOLS = "TLSv1,TLSv1.1,TLSv1.2"; - @UriPath @Metadata(required = "true") + @UriPath(enums = "tcp,udp") @Metadata(required = "true") protected String protocol; @UriPath @Metadata(required = "true") protected String host; @UriPath @Metadata(required = "true") protected int port; - @UriParam + @UriParam(label = "consumer") protected boolean broadcast; @UriParam(defaultValue = "65536") protected long sendBufferSize = 65536; @@ -47,9 +47,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { protected long receiveBufferSize = 65536; @UriParam protected int receiveBufferSizePredictor; - @UriParam(defaultValue = "1") + @UriParam(label = "consumer", defaultValue = "1") protected int bossCount = 1; - @UriParam + @UriParam(label = "consumer") protected int workerCount; @UriParam(defaultValue = "true") protected boolean keepAlive = true; @@ -57,13 +57,13 @@ public class NettyServerBootstrapConfiguration implements Cloneable { protected boolean tcpNoDelay = true; @UriParam(defaultValue = "true") protected boolean reuseAddress = true; - @UriParam(defaultValue = "10000") + @UriParam(label = "producer", defaultValue = "10000") protected long connectTimeout = 10000; - @UriParam + @UriParam(label = "consumer") protected int backlog; - @UriParam + @UriParam(label = "consumer") protected ServerPipelineFactory serverPipelineFactory; - @UriParam + @UriParam(label = "consumer") protected NettyServerBootstrapFactory nettyServerBootstrapFactory; protected Map<String, Object> options; // SSL options is also part of the server bootstrap as the server listener on port X is either plain or SSL @@ -75,7 +75,7 @@ public class NettyServerBootstrapConfiguration implements Cloneable { protected SslHandler sslHandler; @UriParam protected SSLContextParameters sslContextParameters; - @UriParam + @UriParam(label = "consumer") protected boolean needClientAuth; @UriParam protected File keyStoreFile; @@ -95,7 +95,7 @@ public class NettyServerBootstrapConfiguration implements Cloneable { protected String passphrase; protected BossPool bossPool; protected WorkerPool workerPool; - @UriParam + @UriParam(label = "consumer") protected String networkInterface; public String getAddress() { @@ -110,6 +110,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return protocol; } + /** + * The protocol to use which can be tcp or udp. + */ public void setProtocol(String protocol) { this.protocol = protocol; } @@ -118,6 +121,12 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return host; } + /** + * The hostname. + * <p/> + * For the consumer the hostname is localhost or 0.0.0.0 + * For the producer the hostname is the remote host to connect to + */ public void setHost(String host) { this.host = host; } @@ -126,6 +135,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return port; } + /** + * The host port number + */ public void setPort(int port) { this.port = port; } @@ -134,6 +146,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return broadcast; } + /** + * Setting to choose Multicast over UDP + */ public void setBroadcast(boolean broadcast) { this.broadcast = broadcast; } @@ -142,6 +157,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return sendBufferSize; } + /** + * The TCP/UDP buffer sizes to be used during outbound communication. Size is bytes. + */ public void setSendBufferSize(long sendBufferSize) { this.sendBufferSize = sendBufferSize; } @@ -150,6 +168,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return receiveBufferSize; } + /** + * The TCP/UDP buffer sizes to be used during inbound communication. Size is bytes. + */ public void setReceiveBufferSize(long receiveBufferSize) { this.receiveBufferSize = receiveBufferSize; } @@ -158,6 +179,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return receiveBufferSizePredictor; } + /** + * Configures the buffer size predictor. See details at Jetty documentation and this mail thread. + */ public void setReceiveBufferSizePredictor(int receiveBufferSizePredictor) { this.receiveBufferSizePredictor = receiveBufferSizePredictor; } @@ -166,6 +190,10 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return workerCount; } + /** + * When netty works on nio mode, it uses default workerCount parameter from Netty, which is cpu_core_threads*2. + * User can use this operation to override the default workerCount from Netty + */ public void setWorkerCount(int workerCount) { this.workerCount = workerCount; } @@ -174,6 +202,10 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return bossCount; } + /** + * When netty works on nio mode, it uses default bossCount parameter from Netty, which is 1. + * User can use this operation to override the default bossCount from Netty + */ public void setBossCount(int bossCount) { this.bossCount = bossCount; } @@ -182,6 +214,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return keepAlive; } + /** + * Setting to ensure socket is not closed due to inactivity + */ public void setKeepAlive(boolean keepAlive) { this.keepAlive = keepAlive; } @@ -190,6 +225,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return tcpNoDelay; } + /** + * Setting to improve TCP protocol performance + */ public void setTcpNoDelay(boolean tcpNoDelay) { this.tcpNoDelay = tcpNoDelay; } @@ -198,6 +236,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return reuseAddress; } + /** + * Setting to facilitate socket multiplexing + */ public void setReuseAddress(boolean reuseAddress) { this.reuseAddress = reuseAddress; } @@ -206,6 +247,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return connectTimeout; } + /** + * Time to wait for a socket connection to be available. Value is in millis. + */ public void setConnectTimeout(long connectTimeout) { this.connectTimeout = connectTimeout; } @@ -214,6 +258,12 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return 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. + */ public void setBacklog(int backlog) { this.backlog = backlog; } @@ -222,6 +272,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return ssl; } + /** + * Setting to specify whether SSL encryption is applied to this endpoint + */ public void setSsl(boolean ssl) { this.ssl = ssl; } @@ -230,6 +283,10 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return 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. + */ public void setSslClientCertHeaders(boolean sslClientCertHeaders) { this.sslClientCertHeaders = sslClientCertHeaders; } @@ -238,6 +295,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return sslHandler; } + /** + * Reference to a class that could be used to return an SSL Handler + */ public void setSslHandler(SslHandler sslHandler) { this.sslHandler = sslHandler; } @@ -246,6 +306,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return sslContextParameters; } + /** + * To configure security using SSLContextParameters + */ public void setSslContextParameters(SSLContextParameters sslContextParameters) { this.sslContextParameters = sslContextParameters; } @@ -254,6 +317,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return needClientAuth; } + /** + * Configures whether the server needs client authentication when using SSL. + */ public void setNeedClientAuth(boolean needClientAuth) { this.needClientAuth = needClientAuth; } @@ -263,6 +329,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return keyStoreFile; } + /** + * Client side certificate keystore to be used for encryption + */ @Deprecated public void setKeyStoreFile(File keyStoreFile) { this.keyStoreFile = keyStoreFile; @@ -273,6 +342,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return trustStoreFile; } + /** + * Server side certificate keystore to be used for encryption + */ @Deprecated public void setTrustStoreFile(File trustStoreFile) { this.trustStoreFile = trustStoreFile; @@ -282,6 +354,10 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return 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. + */ public void setKeyStoreResource(String keyStoreResource) { this.keyStoreResource = keyStoreResource; } @@ -290,6 +366,10 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return 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. + */ public void setTrustStoreResource(String trustStoreResource) { this.trustStoreResource = trustStoreResource; } @@ -298,6 +378,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return keyStoreFormat; } + /** + * Keystore format to be used for payload encryption. Defaults to "JKS" if not set + */ public void setKeyStoreFormat(String keyStoreFormat) { this.keyStoreFormat = keyStoreFormat; } @@ -306,6 +389,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return securityProvider; } + /** + * Security provider to be used for payload encryption. Defaults to "SunX509" if not set. + */ public void setSecurityProvider(String securityProvider) { this.securityProvider = securityProvider; } @@ -314,6 +400,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return passphrase; } + /** + * Password setting to use in order to encrypt/decrypt payloads sent using SSH + */ public void setPassphrase(String passphrase) { this.passphrase = passphrase; } @@ -322,6 +411,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return serverPipelineFactory; } + /** + * To use a custom ServerPipelineFactory + */ public void setServerPipelineFactory(ServerPipelineFactory serverPipelineFactory) { this.serverPipelineFactory = serverPipelineFactory; } @@ -330,6 +422,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return nettyServerBootstrapFactory; } + /** + * To use a custom NettyServerBootstrapFactory + */ public void setNettyServerBootstrapFactory(NettyServerBootstrapFactory nettyServerBootstrapFactory) { this.nettyServerBootstrapFactory = nettyServerBootstrapFactory; } @@ -338,6 +433,10 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return 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. + */ public void setOptions(Map<String, Object> options) { this.options = options; } @@ -346,6 +445,10 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return bossPool; } + /** + * To use a explicit org.jboss.netty.channel.socket.nio.BossPool as the boss thread pool. + * For example to share a thread pool with multiple consumers. By default each consumer has their own boss pool with 1 core thread. + */ public void setBossPool(BossPool bossPool) { this.bossPool = bossPool; } @@ -354,6 +457,10 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return workerPool; } + /** + * To use a explicit org.jboss.netty.channel.socket.nio.WorkerPool as the worker thread pool. + * For example to share a thread pool with multiple consumers. By default each consumer has their own worker pool with 2 x cpu count core threads. + */ public void setWorkerPool(WorkerPool workerPool) { this.workerPool = workerPool; } @@ -362,6 +469,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return 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. + */ public void setNetworkInterface(String networkInterface) { this.networkInterface = networkInterface; } @@ -370,6 +480,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return enabledProtocols; } + /** + * Which protocols to enable when using SSL + */ public void setEnabledProtocols(String enabledProtocols) { this.enabledProtocols = enabledProtocols; }