Class DispatchMonoHandler<RQ,​RS>

Type Parameters:
RQ - A type of the inbound message this ChannelInboundHandlerAdapter expects.
RS - A type of the outbound message this ChannelInboundHandlerAdapter sends downstream.
All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler
Direct Known Subclasses:
HttpDispatchMonoHandler

@ThreadSafe
@Sharable
public class DispatchMonoHandler<RQ,​RS>
extends ChannelInboundHandlerAdapter
Processes business logic. Uses RequestDispatcher to process requests. This handler must be placed in the ChannelPipeline above (after in the inbound/upstream evaluation order) any decoders, and above (before in the outbound/downstream evaluation order) any encoders:

  ChannelPipeline p = ...;
  ...
  p.addLast(new MyDecoder());
  ...
  p.addLast(new MyEncoder());
  ...
  p.addLast(new DispatchMonoHandler(...));//handles business logic
  ...
  p.addLast(new MyExceptionHandler());
  ...
 
and must not be added to the ChannelPipeline more than once. This handler adds MonoHandler in the ChannelPipeline right below itself in order to guarantee that at any given moment not more than one request per Channel is being processed by RequestDispatcher. Note that MonoHandler disables auto read.