Class NettyConfiguration

All Implemented Interfaces:
Cloneable

@UriParams @Configurer public class NettyConfiguration extends NettyServerBootstrapConfiguration implements Cloneable
  • Constructor Details Link icon

    • NettyConfiguration Link icon

      public NettyConfiguration()
  • Method Details Link icon

    • copy Link icon

      public NettyConfiguration copy()
      Returns a copy of this configuration
    • validateConfiguration Link icon

      public void validateConfiguration()
    • parseURI Link icon

      public void parseURI(URI uri, Map<String,Object> parameters, NettyComponent component, String... supportedProtocols) throws Exception
      Throws:
      Exception
    • getCharsetName Link icon

      public String getCharsetName()
    • getRequestTimeout Link icon

      public long getRequestTimeout()
    • setRequestTimeout Link icon

      public void setRequestTimeout(long 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.
    • isSync Link icon

      public boolean isSync()
    • setSync Link icon

      public void setSync(boolean sync)
      Setting to set endpoint as one-way or request-response
    • isTextline Link icon

      public boolean isTextline()
    • setTextline Link icon

      public void setTextline(boolean 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 - however only Strings are allowed to be serialized by default.
    • getDecoderMaxLineLength Link icon

      public int getDecoderMaxLineLength()
    • setDecoderMaxLineLength Link icon

      public void setDecoderMaxLineLength(int decoderMaxLineLength)
      The max line length to use for the textline codec.
    • getDelimiter Link icon

      public TextLineDelimiter getDelimiter()
    • setDelimiter Link icon

      public void setDelimiter(TextLineDelimiter delimiter)
      The delimiter to use for the textline codec. Possible values are LINE and NULL.
    • isAutoAppendDelimiter Link icon

      public boolean isAutoAppendDelimiter()
    • setAutoAppendDelimiter Link icon

      public void setAutoAppendDelimiter(boolean autoAppendDelimiter)
      Whether or not to auto append missing end delimiter when sending using the textline codec.
    • getEncoding Link icon

      public String getEncoding()
    • setEncoding Link icon

      public void setEncoding(String encoding)
      The encoding (a charset name) to use for the textline codec. If not provided, Camel will use the JVM default Charset.
    • getDecodersAsList Link icon

      public List<io.netty.channel.ChannelHandler> getDecodersAsList()
    • setDecodersAsList Link icon

      public void setDecodersAsList(List<io.netty.channel.ChannelHandler> decoders)
    • setDecoders Link icon

      public void setDecoders(List<io.netty.channel.ChannelHandler> 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.
    • setDecoders Link icon

      public void setDecoders(String 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.
    • getDecoders Link icon

      public String getDecoders()
    • getEncodersAsList Link icon

      public List<io.netty.channel.ChannelHandler> getEncodersAsList()
    • setEncodersAsList Link icon

      public void setEncodersAsList(List<io.netty.channel.ChannelHandler> encoders)
    • setEncoders Link icon

      public void setEncoders(List<io.netty.channel.ChannelHandler> 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.
    • setEncoders Link icon

      public void setEncoders(String 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.
    • getEncoders Link icon

      public String getEncoders()
    • addEncoder Link icon

      public void addEncoder(io.netty.channel.ChannelHandler encoder)
      Adds a custom ChannelHandler class that can be used to perform special marshalling of outbound payloads.
    • addDecoder Link icon

      public void addDecoder(io.netty.channel.ChannelHandler decoder)
      Adds a custom ChannelHandler class that can be used to perform special marshalling of inbound payloads.
    • isDisconnect Link icon

      public boolean isDisconnect()
    • setDisconnect Link icon

      public void setDisconnect(boolean disconnect)
      Whether or not to disconnect(close) from Netty Channel right after use. Can be used for both consumer and producer.
    • isLazyChannelCreation Link icon

      public boolean isLazyChannelCreation()
    • setLazyChannelCreation Link icon

      public void setLazyChannelCreation(boolean lazyChannelCreation)
      Channels can be lazily created to avoid exceptions, if the remote server is not up and running when the Camel producer is started.
    • isTransferExchange Link icon

      public boolean isTransferExchange()
    • setTransferExchange Link icon

      public void setTransferExchange(boolean 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.
    • isAllowSerializedHeaders Link icon

      public boolean isAllowSerializedHeaders()
    • setAllowSerializedHeaders Link icon

      public void setAllowSerializedHeaders(boolean allowSerializedHeaders)
      Only used for TCP when transferExchange is true. When set to true, serializable objects in headers and properties will be added to the exchange. Otherwise Camel will exclude any non-serializable objects and log it at WARN level.
    • isDisconnectOnNoReply Link icon

      public boolean isDisconnectOnNoReply()
    • setDisconnectOnNoReply Link icon

      public void setDisconnectOnNoReply(boolean disconnectOnNoReply)
      If sync is enabled then this option dictates NettyConsumer if it should disconnect where there is no reply to send back.
    • getNoReplyLogLevel Link icon

      public org.apache.camel.LoggingLevel getNoReplyLogLevel()
    • setNoReplyLogLevel Link icon

      public void setNoReplyLogLevel(org.apache.camel.LoggingLevel noReplyLogLevel)
      If sync is enabled this option dictates NettyConsumer which logging level to use when logging a there is no reply to send back.
    • getServerExceptionCaughtLogLevel Link icon

      public org.apache.camel.LoggingLevel getServerExceptionCaughtLogLevel()
    • setServerExceptionCaughtLogLevel Link icon

      public void setServerExceptionCaughtLogLevel(org.apache.camel.LoggingLevel serverExceptionCaughtLogLevel)
      If the server (NettyConsumer) catches an exception then its logged using this logging level.
    • getServerClosedChannelExceptionCaughtLogLevel Link icon

      public org.apache.camel.LoggingLevel getServerClosedChannelExceptionCaughtLogLevel()
    • setServerClosedChannelExceptionCaughtLogLevel Link icon

      public void setServerClosedChannelExceptionCaughtLogLevel(org.apache.camel.LoggingLevel 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.
    • isAllowDefaultCodec Link icon

      public boolean isAllowDefaultCodec()
    • setAllowDefaultCodec Link icon

      public void setAllowDefaultCodec(boolean allowDefaultCodec)
      The netty component installs a default codec if both, encoder/decoder 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.
    • setClientPipelineFactory Link icon

      @Deprecated public void setClientPipelineFactory(ClientInitializerFactory clientPipelineFactory)
      Deprecated.
      use #setClientInitializerFactory
    • getClientPipelineFactory Link icon

      @Deprecated public ClientInitializerFactory getClientPipelineFactory()
      Deprecated.
      use #getClientInitializerFactory
    • getClientInitializerFactory Link icon

      public ClientInitializerFactory getClientInitializerFactory()
    • setClientInitializerFactory Link icon

      public void setClientInitializerFactory(ClientInitializerFactory clientInitializerFactory)
      To use a custom ClientInitializerFactory
    • isUsingExecutorService Link icon

      public boolean isUsingExecutorService()
    • setUsingExecutorService Link icon

      public void setUsingExecutorService(boolean usingExecutorService)
      Whether to use ordered thread pool, to ensure events are processed orderly on the same channel.
    • getProducerPoolMaxTotal Link icon

      public int getProducerPoolMaxTotal()
    • setProducerPoolMaxTotal Link icon

      public void setProducerPoolMaxTotal(int producerPoolMaxTotal)
      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.
    • getProducerPoolMinIdle Link icon

      public int getProducerPoolMinIdle()
    • setProducerPoolMinIdle Link icon

      public void setProducerPoolMinIdle(int producerPoolMinIdle)
      Sets the minimum number of instances allowed in the producer pool before the evictor thread (if active) spawns new objects.
    • getProducerPoolMaxIdle Link icon

      public int getProducerPoolMaxIdle()
    • setProducerPoolMaxIdle Link icon

      public void setProducerPoolMaxIdle(int producerPoolMaxIdle)
      Sets the cap on the number of "idle" instances in the pool.
    • getProducerPoolMinEvictableIdle Link icon

      public long getProducerPoolMinEvictableIdle()
    • setProducerPoolMinEvictableIdle Link icon

      public void setProducerPoolMinEvictableIdle(long 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.
    • getProducerPoolMaxWait Link icon

      public long getProducerPoolMaxWait()
    • setProducerPoolMaxWait Link icon

      public void setProducerPoolMaxWait(long producerPoolMaxWait)
      Sets the maximum duration (value in millis) the borrowObject() method should block before throwing an exception when the pool is exhausted and producerPoolBlockWhenExhausted is true. When less than 0, the borrowObject() method may block indefinitely.
    • isProducerPoolBlockWhenExhausted Link icon

      public boolean isProducerPoolBlockWhenExhausted()
    • setProducerPoolBlockWhenExhausted Link icon

      public void setProducerPoolBlockWhenExhausted(boolean producerPoolBlockWhenExhausted)
      Sets the value for the blockWhenExhausted configuration attribute. It determines whether to block when the borrowObject() method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).
    • isProducerPoolEnabled Link icon

      public boolean isProducerPoolEnabled()
    • setProducerPoolEnabled Link icon

      public void setProducerPoolEnabled(boolean producerPoolEnabled)
      Whether producer pool is enabled or not.

      Important: If you turn this off then a single shared connection is used for the producer, also if you are doing request/reply. That means there is a potential issue with interleaved responses if replies comes back out-of-order. Therefore you need to have a correlation id in both the request and reply messages so you can properly correlate the replies to the Camel callback that is responsible for continue processing the message in Camel. To do this you need to implement NettyCamelStateCorrelationManager as correlation manager and configure it via the correlationManager option.

      See also the correlationManager option for more details.

    • isUdpConnectionlessSending Link icon

      public boolean isUdpConnectionlessSending()
    • setUdpConnectionlessSending Link icon

      public void setUdpConnectionlessSending(boolean 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.
    • isClientMode Link icon

      public boolean isClientMode()
    • setClientMode Link icon

      public void setClientMode(boolean clientMode)
      If the clientMode is true, netty consumer will connect the address as a TCP client.
    • isUseByteBuf Link icon

      public boolean isUseByteBuf()
    • setUseByteBuf Link icon

      public void setUseByteBuf(boolean useByteBuf)
      If the useByteBuf is true, netty producer will turn the message body into ByteBuf before sending it out.
    • isUdpByteArrayCodec Link icon

      public boolean isUdpByteArrayCodec()
    • setUdpByteArrayCodec Link icon

      public void setUdpByteArrayCodec(boolean udpByteArrayCodec)
      For UDP only. If enabled the using byte array codec instead of Java serialization protocol.
    • isReuseChannel Link icon

      public boolean isReuseChannel()
    • setReuseChannel Link icon

      public void setReuseChannel(boolean reuseChannel)
      This option allows producers and consumers (in client mode) to reuse the same Netty Channel for the lifecycle of processing the Exchange. This is useful if you need to call a server multiple times in a Camel route and want to use the same network connection. When using this, the channel is not returned to the connection pool until the Exchange is done; or disconnected if the disconnect option is set to true.

      The reused Channel is stored on the Exchange as an exchange property with the key NettyConstants.NETTY_CHANNEL which allows you to obtain the channel during routing and use it as well.

    • getCorrelationManager Link icon

      public NettyCamelStateCorrelationManager getCorrelationManager()
    • setCorrelationManager Link icon

      public void setCorrelationManager(NettyCamelStateCorrelationManager correlationManager)
      To use a custom correlation manager to manage how request and reply messages are mapped when using request/reply with the netty producer. This should only be used if you have a way to map requests together with replies such as if there is correlation ids in both the request and reply messages. This can be used if you want to multiplex concurrent messages on the same channel (aka connection) in netty. When doing this you must have a way to correlate the request and reply messages so you can store the right reply on the inflight Camel Exchange before its continued routed.

      We recommend extending the TimeoutCorrelationManagerSupport when you build custom correlation managers. This provides support for timeout and other complexities you otherwise would need to implement as well.

      See also the producerPoolEnabled option for more details.

    • isHostnameVerification Link icon

      public boolean isHostnameVerification()
    • setHostnameVerification Link icon

      public void setHostnameVerification(boolean hostnameVerification)
      To enable/disable hostname verification on SSLEngine