Package org.apache.camel.component.netty
Class NettyHelper
- java.lang.Object
-
- org.apache.camel.component.netty.NettyHelper
-
public final class NettyHelper extends Object
Helper class used internally by camel-netty using Netty.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
close(io.netty.channel.Channel channel)
Closes the given channel asynchronouslystatic io.netty.util.concurrent.EventExecutorGroup
createExecutorGroup(org.apache.camel.CamelContext camelContext, String name, int threads)
Creates aDefaultEventExecutorGroup
with the given name and maximum thread pool size.static String
getTextlineBody(Object body, org.apache.camel.Exchange exchange, TextLineDelimiter delimiter, boolean autoAppendDelimiter)
Gets the string body to be used when sending with the textline codec.static void
writeBodyAsync(org.slf4j.Logger log, io.netty.channel.Channel channel, SocketAddress remoteAddress, Object body, io.netty.channel.ChannelFutureListener listener)
Writes the given body to Netty channel.
-
-
-
Method Detail
-
getTextlineBody
public static String getTextlineBody(Object body, org.apache.camel.Exchange exchange, TextLineDelimiter delimiter, boolean autoAppendDelimiter) throws org.apache.camel.NoTypeConversionAvailableException
Gets the string body to be used when sending with the textline codec.- Parameters:
body
- the current bodyexchange
- the exchangedelimiter
- the textline delimiterautoAppendDelimiter
- whether absent delimiter should be auto appended- Returns:
- the string body to send
- Throws:
org.apache.camel.NoTypeConversionAvailableException
- is thrown if the current body could not be converted to a String type
-
writeBodyAsync
public static void writeBodyAsync(org.slf4j.Logger log, io.netty.channel.Channel channel, SocketAddress remoteAddress, Object body, io.netty.channel.ChannelFutureListener listener)
Writes the given body to Netty channel. Will notwait until the body has been written.- Parameters:
log
- logger to usechannel
- the Netty channelremoteAddress
- the remote address when using UDPbody
- the body to write (send)listener
- listener with work to be executed when the operation is complete
-
close
public static void close(io.netty.channel.Channel channel)
Closes the given channel asynchronously- Parameters:
channel
- the channel to close
-
createExecutorGroup
public static io.netty.util.concurrent.EventExecutorGroup createExecutorGroup(org.apache.camel.CamelContext camelContext, String name, int threads)
Creates aDefaultEventExecutorGroup
with the given name and maximum thread pool size.
-
-