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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
beforeProcess
(org.apache.camel.Exchange exchange, io.netty.channel.ChannelHandlerContext ctx, Object message) Allows any custom logic before theExchange
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 org.apache.camel.Exchange
createExchange
(io.netty.channel.ChannelHandlerContext ctx, Object message) protected io.netty.channel.ChannelFutureListener
createResponseFutureListener
(NettyConsumer consumer, org.apache.camel.Exchange exchange, SocketAddress remoteAddress) Creates theChannelFutureListener
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.Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Constructor Details
-
ServerChannelHandler
-
-
Method Details
-
channelActive
- Specified by:
channelActive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelActive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
channelInactive
- Specified by:
channelInactive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelInactive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in 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 theExchange
is 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 theChannelFutureListener
to execute when writing the response is complete.- Parameters:
consumer
- the netty consumerexchange
- the exchangeremoteAddress
- the remote address of the message- Returns:
- the listener.
-