akka.io
Class TcpPipelineHandler<Ctx extends PipelineContext,Cmd,Evt>

java.lang.Object
  extended by akka.io.TcpPipelineHandler<Ctx,Cmd,Evt>
All Implemented Interfaces:
Actor, RequiresMessageQueue<UnboundedMessageQueueSemantics>

public class TcpPipelineHandler<Ctx extends PipelineContext,Cmd,Evt>
extends java.lang.Object
implements Actor, RequiresMessageQueue<UnboundedMessageQueueSemantics>

This actor wraps a pipeline and forwards commands and events between that one and a Tcp connection actor. In order to inject commands into the pipeline send an TcpPipelineHandler.Init.Command message to this actor; events will be sent to the designated handler wrapped in TcpPipelineHandler.Init.Event messages.

When the designated handler terminates the TCP connection is aborted. When the connection actor terminates this actor terminates as well; the designated handler may want to watch this actor’s lifecycle.

IMPORTANT:

Proper function of this actor (and of other pipeline stages like TcpReadWriteAdapter depends on the fact that stages handling TCP commands and events pass unknown subtypes through unaltered. There are more commands and events than are declared within the Tcp object and you can even define your own.


Nested Class Summary
static class TcpPipelineHandler.Init<Ctx extends PipelineContext,Cmd,Evt>
          This class wraps up a pipeline with its external (i.e.
static class TcpPipelineHandler.Management
          Wrapper class for management commands sent to the TcpPipelineHandler actor.
static class TcpPipelineHandler.Management$
           
static class TcpPipelineHandler.TcpEvent
          The pipeline may want to emit a Tcp.Event to the registered handler actor, which is enabled by emitting this Tcp.Command wrapping an event instead.
static class TcpPipelineHandler.TcpEvent$
           
static class TcpPipelineHandler.Tell
          This is a new Tcp.Command which the pipeline can emit to effect the sending a message to another actor.
static class TcpPipelineHandler.Tell$
           
static interface TcpPipelineHandler.WithinActorContext
          This interface bundles logging and ActorContext for Java.
 
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$
 
Constructor Summary
TcpPipelineHandler(TcpPipelineHandler.Init<Ctx,Cmd,Evt> init, ActorRef connection, ActorRef handler)
           
 
Method Summary
 Ctx ctx()
           
 PipelineInjector<Cmd,Tcp.Event> pipes()
           
static
<Ctx extends PipelineContext,Cmd,Evt>
Props
props(TcpPipelineHandler.Init<Ctx,Cmd,Evt> init, ActorRef connection, ActorRef handler)
          create Props for a pipeline handler
 scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
          This defines the initial actor behavior, it must return a partial function with the actor logic.
static
<Cmd,Evt> TcpPipelineHandler.Init<TcpPipelineHandler.WithinActorContext,Cmd,Evt>
withLogger(LoggingAdapter log, PipelineStage<? extends PipelineContext,Cmd,Tcp.Command,Evt,Tcp.Event> stages)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface akka.actor.Actor
context, noSender, postRestart, postStop, preRestart, preStart, self, sender, supervisorStrategy, unhandled
 

Constructor Detail

TcpPipelineHandler

public TcpPipelineHandler(TcpPipelineHandler.Init<Ctx,Cmd,Evt> init,
                          ActorRef connection,
                          ActorRef handler)
Method Detail

withLogger

public static <Cmd,Evt> TcpPipelineHandler.Init<TcpPipelineHandler.WithinActorContext,Cmd,Evt> withLogger(LoggingAdapter log,
                                                                                                          PipelineStage<? extends PipelineContext,Cmd,Tcp.Command,Evt,Tcp.Event> stages)

props

public static <Ctx extends PipelineContext,Cmd,Evt> Props props(TcpPipelineHandler.Init<Ctx,Cmd,Evt> init,
                                                                ActorRef connection,
                                                                ActorRef handler)
create Props for a pipeline handler


ctx

public Ctx ctx()

pipes

public PipelineInjector<Cmd,Tcp.Event> pipes()

receive

public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Description copied from interface: Actor
This defines the initial actor behavior, it must return a partial function with the actor logic.

Specified by:
receive in interface Actor