org.apache.camel.component.netty.handlers
Class ServerChannelHandler
java.lang.Object
org.jboss.netty.channel.SimpleChannelUpstreamHandler
org.apache.camel.component.netty.handlers.ServerChannelHandler
- All Implemented Interfaces:
- org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler
public class ServerChannelHandler
- extends org.jboss.netty.channel.SimpleChannelUpstreamHandler
Client handler which cannot be shared
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler |
org.jboss.netty.channel.ChannelHandler.Sharable |
Method Summary |
protected void |
beforeProcess(org.apache.camel.Exchange exchange,
org.jboss.netty.channel.MessageEvent messageEvent)
Allows any custom logic before the Exchange is processed by the routing engine. |
void |
channelClosed(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ChannelStateEvent e)
|
void |
channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ChannelStateEvent e)
|
protected org.jboss.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(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ExceptionEvent exceptionEvent)
|
protected Object |
getResponseBody(org.apache.camel.Exchange exchange)
Gets the object we want to use as the response object for sending to netty. |
void |
messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent messageEvent)
|
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler |
channelBound, channelConnected, channelDisconnected, channelInterestChanged, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ServerChannelHandler
public ServerChannelHandler(NettyConsumer consumer)
channelOpen
public void channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ChannelStateEvent e)
throws Exception
- Overrides:
channelOpen
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
- Throws:
Exception
channelClosed
public void channelClosed(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ChannelStateEvent e)
throws Exception
- Overrides:
channelClosed
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
- Throws:
Exception
exceptionCaught
public void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ExceptionEvent exceptionEvent)
throws Exception
- Overrides:
exceptionCaught
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
- Throws:
Exception
messageReceived
public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent messageEvent)
throws Exception
- Overrides:
messageReceived
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
- Throws:
Exception
beforeProcess
protected void beforeProcess(org.apache.camel.Exchange exchange,
org.jboss.netty.channel.MessageEvent messageEvent)
- Allows any custom logic before the
Exchange
is processed by the routing engine.
- Parameters:
exchange
- the exchangemessageEvent
- the Netty message event
getResponseBody
protected Object getResponseBody(org.apache.camel.Exchange exchange)
throws Exception
- 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 org.jboss.netty.channel.ChannelFutureListener createResponseFutureListener(NettyConsumer consumer,
org.apache.camel.Exchange exchange,
SocketAddress remoteAddress)
- Creates the
ChannelFutureListener
to execute when writing the response is complete.
- Parameters:
consumer
- the netty consumerexchange
- the exchangeremoteAddress
- the remote address of the message
- Returns:
- the listener.
Apache Camel