Class ServerChannelHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<Object>
org.apache.camel.component.netty.handlers.ServerChannelHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
Server handler which cannot be shared
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbeforeProcess(org.apache.camel.Exchange exchange, io.netty.channel.ChannelHandlerContext ctx, Object message) Allows any custom logic before theExchangeis processed by the routing engine.voidchannelActive(io.netty.channel.ChannelHandlerContext ctx) voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) protected voidchannelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg) protected org.apache.camel.ExchangecreateExchange(io.netty.channel.ChannelHandlerContext ctx, Object message) protected io.netty.channel.ChannelFutureListenercreateResponseFutureListener(NettyConsumer consumer, org.apache.camel.Exchange exchange, SocketAddress remoteAddress) Creates theChannelFutureListenerto execute when writing the response is complete.voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) protected ObjectgetResponseBody(org.apache.camel.Exchange exchange) Gets the object we want to use as the response object for sending to netty.Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelReadMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Constructor Details
-
ServerChannelHandler
-
-
Method Details
-
channelActive
- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelInactive
- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelRead0
-
createExchange
protected org.apache.camel.Exchange createExchange(io.netty.channel.ChannelHandlerContext ctx, Object message) throws Exception - Throws:
Exception
-
beforeProcess
protected void beforeProcess(org.apache.camel.Exchange exchange, io.netty.channel.ChannelHandlerContext ctx, Object message) Allows any custom logic before theExchangeis processed by the routing engine.- Parameters:
exchange- the exchangectx- the channel handler contextmessage- the message which needs to be sent
-
getResponseBody
Gets the object we want to use as the response object for sending to netty.- Parameters:
exchange- the exchange- Returns:
- the object to use as response
- Throws:
Exception- is thrown if error getting the response body
-
createResponseFutureListener
protected io.netty.channel.ChannelFutureListener createResponseFutureListener(NettyConsumer consumer, org.apache.camel.Exchange exchange, SocketAddress remoteAddress) Creates theChannelFutureListenerto execute when writing the response is complete.- Parameters:
consumer- the netty consumerexchange- the exchangeremoteAddress- the remote address of the message- Returns:
- the listener.
-