org.apache.camel.component.netty
Class NettyHelper

java.lang.Object
  extended by org.apache.camel.component.netty.NettyHelper

public final class NettyHelper
extends Object

Helper class used internally by camel-netty using Netty.

Version:

Field Summary
static int DEFAULT_IO_THREADS
           
 
Method Summary
static void close(org.jboss.netty.channel.Channel channel)
          Closes the given channel asynchronously
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, org.jboss.netty.channel.Channel channel, SocketAddress remoteAddress, Object body, org.apache.camel.Exchange exchange, org.jboss.netty.channel.ChannelFutureListener listener)
          Writes the given body to Netty channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_IO_THREADS

public static final int DEFAULT_IO_THREADS
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 body
exchange - the exchange
delimiter - the textline delimiter
autoAppendDelimiter - 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,
                                  org.jboss.netty.channel.Channel channel,
                                  SocketAddress remoteAddress,
                                  Object body,
                                  org.apache.camel.Exchange exchange,
                                  org.jboss.netty.channel.ChannelFutureListener listener)
Writes the given body to Netty channel. Will notwait until the body has been written.

Parameters:
log - logger to use
channel - the Netty channel
remoteAddress - the remote address when using UDP
body - the body to write (send)
exchange - the exchange
listener - listener with work to be executed when the operation is complete

close

public static void close(org.jboss.netty.channel.Channel channel)
Closes the given channel asynchronously

Parameters:
channel - the channel to close


Apache Camel