Netty4

Netty4

Scheme: netty4
Syntax: netty4:protocol:host:port
Description: Socket level networking using TCP or UDP with the Netty 4.x library.
Deprecated:false
Async:true
Maven: org.apache.camel/camel-netty4/2.18.1.redhat-000034

Socket level networking using TCP or UDP with the Netty 4.x library.

Name Kind Group Required Default Type Enum Description
protocol path common true java.lang.String tcp
udp
The protocol to use which can be tcp or udp.
host path common true java.lang.String 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

port path common true int The host port number
disconnect parameter common boolean Whether or not to disconnect(close) from Netty Channel right after use. Can be used for both consumer and producer.
keepAlive parameter common true boolean Setting to ensure socket is not closed due to inactivity
reuseAddress parameter common true boolean Setting to facilitate socket multiplexing
sync parameter common true boolean Setting to set endpoint as one-way or request-response
tcpNoDelay parameter common true boolean Setting to improve TCP protocol performance
bridgeErrorHandler parameter consumer boolean Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored.
broadcast parameter consumer boolean Setting to choose Multicast over UDP
clientMode parameter consumer boolean If the clientMode is true, netty consumer will connect the address as a TCP client.
reconnect parameter consumer true boolean Used only in clientMode in consumer, the consumer will attempt to reconnect on disconnection if this is enabled
reconnectInterval parameter consumer 10000 int Used if reconnect and clientMode is enabled. The interval in milli seconds to attempt reconnection
backlog parameter consumer (advanced) int 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.
bossCount parameter consumer (advanced) 1 int 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
bossGroup parameter consumer (advanced) io.netty.channel.EventLoopGroup Set the BossGroup which could be used for handling the new connection of the server side across the NettyEndpoint
disconnectOnNoReply parameter consumer (advanced) true boolean If sync is enabled then this option dictates NettyConsumer if it should disconnect where there is no reply to send back.
exceptionHandler parameter consumer (advanced) org.apache.camel.spi.ExceptionHandler To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.
exchangePattern parameter consumer (advanced) org.apache.camel.ExchangePattern InOnly
RobustInOnly
InOut
InOptionalOut
OutOnly
RobustOutOnly
OutIn
OutOptionalIn
Sets the exchange pattern when the consumer creates an exchange.
nettyServerBootstrapFactory parameter consumer (advanced) org.apache.camel.component.netty4.NettyServerBootstrapFactory To use a custom NettyServerBootstrapFactory
networkInterface parameter consumer (advanced) java.lang.String 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.
noReplyLogLevel parameter consumer (advanced) WARN org.apache.camel.LoggingLevel TRACE
DEBUG
INFO
WARN
ERROR
OFF
If sync is enabled this option dictates NettyConsumer which logging level to use when logging a there is no reply to send back.
serverClosedChannelExceptionCaughtLogLevel parameter consumer (advanced) DEBUG org.apache.camel.LoggingLevel TRACE
DEBUG
INFO
WARN
ERROR
OFF
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.
serverExceptionCaughtLogLevel parameter consumer (advanced) WARN org.apache.camel.LoggingLevel TRACE
DEBUG
INFO
WARN
ERROR
OFF
If the server (NettyConsumer) catches an exception then its logged using this logging level.
serverInitializerFactory parameter consumer (advanced) org.apache.camel.component.netty4.ServerInitializerFactory To use a custom ServerInitializerFactory
usingExecutorService parameter consumer (advanced) true boolean Whether to use ordered thread pool, to ensure events are processed orderly on the same channel.
workerCount parameter consumer (advanced) int 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
workerGroup parameter consumer (advanced) io.netty.channel.EventLoopGroup To use a explicit EventLoopGroup 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.
connectTimeout parameter producer 10000 int Time to wait for a socket connection to be available. Value is in millis.
requestTimeout parameter producer long 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.
reuseChannel parameter producer boolean This option allows producers to reuse the same Netty {@link Channel} for the lifecycle of processing the {@link Exchange}. This is useable 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 {@link Exchange} is done; or disconnected if the disconnect option is set to true.

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

clientInitializerFactory parameter producer (advanced) org.apache.camel.component.netty4.ClientInitializerFactory To use a custom ClientInitializerFactory
lazyChannelCreation parameter producer (advanced) true boolean Channels can be lazily created to avoid exceptions, if the remote server is not up and running when the Camel producer is started.
producerPoolEnabled parameter producer (advanced) true boolean 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.
producerPoolMaxActive parameter producer (advanced) -1 int 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.
producerPoolMaxIdle parameter producer (advanced) 100 int Sets the cap on the number of "idle" instances in the pool.
producerPoolMinEvictableIdle parameter producer (advanced) 300000 long 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.
producerPoolMinIdle parameter producer (advanced) int Sets the minimum number of instances allowed in the producer pool before the evictor thread (if active) spawns new objects.
udpConnectionlessSending parameter producer (advanced) boolean 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.
useByteBuf parameter producer (advanced) boolean If the useByteBuf is true, netty producer will turn the message body into {@link ByteBuf} before sending it out.
allowSerializedHeaders parameter advanced false boolean 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.
bootstrapConfiguration parameter advanced org.apache.camel.component.netty4.NettyServerBootstrapConfiguration To use a custom configured NettyServerBootstrapConfiguration for configuring this endpoint.
channelGroup parameter advanced io.netty.channel.group.ChannelGroup To use a explicit ChannelGroup.
nativeTransport parameter advanced boolean 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
options parameter advanced java.util.Map 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.
receiveBufferSize parameter advanced 65536 int The TCP/UDP buffer sizes to be used during inbound communication. Size is bytes.
receiveBufferSizePredictor parameter advanced int Configures the buffer size predictor. See details at Jetty documentation and this mail thread.
sendBufferSize parameter advanced 65536 int The TCP/UDP buffer sizes to be used during outbound communication. Size is bytes.
synchronous parameter advanced false boolean Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).
transferExchange parameter advanced boolean 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.
udpByteArrayCodec parameter advanced boolean For UDP only. If enabled the using byte array codec instead of Java serialization protocol.
allowDefaultCodec parameter codec true boolean 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.
autoAppendDelimiter parameter codec true boolean Whether or not to auto append missing end delimiter when sending using the textline codec.
decoder parameter codec io.netty.channel.ChannelHandler A custom ChannelHandler class that can be used to perform special marshalling of inbound payloads.
decoderMaxLineLength parameter codec 1024 int The max line length to use for the textline codec.
decoders parameter codec java.lang.String 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.
delimiter parameter codec LINE org.apache.camel.component.netty4.TextLineDelimiter LINE
NULL
The delimiter to use for the textline codec. Possible values are LINE and NULL.
encoder parameter codec io.netty.channel.ChannelHandler A custom ChannelHandler class that can be used to perform special marshalling of outbound payloads.
encoders parameter codec java.lang.String 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.
encoding parameter codec java.lang.String The encoding (a charset name) to use for the textline codec. If not provided, Camel will use the JVM default Charset.
textline parameter codec boolean 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.
enabledProtocols parameter security TLSv1,TLSv1.1,TLSv1.2 java.lang.String Which protocols to enable when using SSL
keyStoreFile parameter security java.io.File Client side certificate keystore to be used for encryption
keyStoreFormat parameter security java.lang.String Keystore format to be used for payload encryption. Defaults to "JKS" if not set
keyStoreResource parameter security java.lang.String 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.
needClientAuth parameter security boolean Configures whether the server needs client authentication when using SSL.
passphrase parameter security java.lang.String Password setting to use in order to encrypt/decrypt payloads sent using SSH
securityProvider parameter security java.lang.String Security provider to be used for payload encryption. Defaults to "SunX509" if not set.
ssl parameter security boolean Setting to specify whether SSL encryption is applied to this endpoint
sslClientCertHeaders parameter security boolean 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.
sslContextParameters parameter security org.apache.camel.util.jsse.SSLContextParameters To configure security using SSLContextParameters
sslHandler parameter security io.netty.handler.ssl.SslHandler Reference to a class that could be used to return an SSL Handler
trustStoreFile parameter security java.io.File Server side certificate keystore to be used for encryption
trustStoreResource parameter security java.lang.String 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.

netty4 consumer