public class ServerChannelHandler extends io.netty.channel.SimpleChannelInboundHandler<Object>
Constructor and Description |
---|
ServerChannelHandler(NettyConsumer consumer) |
Modifier and Type | Method and Description |
---|---|
protected void |
beforeProcess(org.apache.camel.Exchange exchange,
io.netty.channel.ChannelHandlerContext ctx,
Object message)
Allows any custom logic before the
Exchange is processed by the routing engine. |
void |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx) |
protected void |
channelRead0(io.netty.channel.ChannelHandlerContext ctx,
Object msg) |
protected io.netty.channel.ChannelFutureListener |
createResponseFutureListener(NettyConsumer consumer,
org.apache.camel.Exchange exchange,
SocketAddress remoteAddress)
Creates the
ChannelFutureListener to execute when writing the response is complete. |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
protected Object |
getResponseBody(org.apache.camel.Exchange exchange)
Gets the object we want to use as the response object for sending to netty.
|
acceptInboundMessage, channelRead
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
public ServerChannelHandler(NettyConsumer consumer)
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelActive
in interface io.netty.channel.ChannelInboundHandler
channelActive
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelInactive
in interface io.netty.channel.ChannelInboundHandler
channelInactive
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
exceptionCaught
in interface io.netty.channel.ChannelHandler
exceptionCaught
in interface io.netty.channel.ChannelInboundHandler
exceptionCaught
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
protected void beforeProcess(org.apache.camel.Exchange exchange, io.netty.channel.ChannelHandlerContext ctx, Object message)
Exchange
is processed by the routing engine.exchange
- the exchangectx
- the channel handler contextmessage
- the message which needs to be sentprotected Object getResponseBody(org.apache.camel.Exchange exchange) throws Exception
exchange
- the exchangeException
- is thrown if error getting the response bodyprotected io.netty.channel.ChannelFutureListener createResponseFutureListener(NettyConsumer consumer, org.apache.camel.Exchange exchange, SocketAddress remoteAddress)
ChannelFutureListener
to execute when writing the response is complete.consumer
- the netty consumerexchange
- the exchangeremoteAddress
- the remote address of the messageApache Camel