Packages

  • package root

    Akka Actors to build Reactive TCP servers using Akka Actors

    Homepage: http://www.aspl.es/ronda
    Mailing list: http://lists.aspl.es/cgi-bin/mailman/listinfo/rondabridge

    Overview

    RondaBridge is a set of Akka Actors, written in Scala, that provides support to create TcpListeners and TcpConnections.

    Even though creating TcpClient software is supported, RondaBridge is more targeted to server side development for safe, scalable, concurrent and reactive TCP servers on top of Akka Actors system.

    RondaBridge aims to provide full support to create TcpListeners, including support for TLS, TLS SNI, multi-tenant configuration, and WebSocket.

    RondaBridge is OpenSource, released under the LGPL 2.1 is checked with an intense regression test that is expanded as much as we can. It is written using ScalaTest.

    We are using RondaBridge to provide Tcp support for MyQtt (https://www.aspl.es/myqtt).

    How to include RondaBridge

    Include the following into your build.sbt:

    lazy val rondaVersion = "0.11.127"
    libraryDependencies ++= Seq("es.aspl.ronda" %% "ronda-bridge" % rondaVersion)

    Or, download it from github and do a local install:

    >> git clone git://github.com/ASPLes/RondaBridge.gite
    >> cd RondaBridge
    >> sbt
    > compile
    > publishLocal

    ...and then include/import RondaBridge from your proyect as indicated above.

    How to create a TcpListener
    import ronda.tcp._
    class YourListenerActor extends Actor {
       // create a listener Actor
       val listener = TcpListener.create
       // bind tcp/4096 port
       listener ! BindPort (4096)
    
       ...rest of the actor class definition, including 'def receive'
    }
    How to get notifications for new incoming connections

    The actor that created the TcpListener, which is the master actor by that step, will get ronda.tcp.Api.NewConnection notification:

    class YourListenerActor extends Actor {
       // create a listener Actor
       val listener = TcpListener.create
       // bind tcp/4096 port
       listener ! BindPort (4096)
    
       // No need to send OnConnectionNew message because we have
       // created the listener and sent ronda.tcp.Api.BindPort
       // But, if we are a different actor wi will have to:
       // listener ! OnConnectionNew
    
       def receive = {
          case NewConnection (listener, connection, connFromAddress, connFromPort, listenerAddress, listenerPort) =>
            info (s"New connection received from ${connFromAddress}, local tcp connection actor: ${connection}")
       }
    }

    As you can see, a ronda.tcp.Api.NewConnection message along with new connection is received everytime a new incoming connection is received.

    Next steps

    Once created a TcpListener or a TcpConnection, use Api messages available to interact with these actors, to configure them and to make them do the useful work.

    Definition Classes
    root
  • package ronda
    Definition Classes
    root
  • package tcp
    Definition Classes
    ronda
  • Api
  • TcpConnection
  • TcpConnectionReader
  • TcpListener

class TcpListener extends Actor with Timers

Linear Supertypes
Timers, Actor, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TcpListener
  2. Timers
  3. Actor
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TcpListener()

Type Members

  1. type Receive = PartialFunction[Any, Unit]
    Definition Classes
    Actor

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def acceptConnection(key: SelectionKey): Unit
  5. def acceptIncomingConnections: Unit
  6. def aroundPostRestart(reason: Throwable): Unit
    Attributes
    protected[akka]
    Definition Classes
    Actor
    Annotations
    @InternalApi()
  7. def aroundPostStop(): Unit
    Attributes
    protected[akka]
    Definition Classes
    Timers → Actor
  8. def aroundPreRestart(reason: Throwable, message: Option[Any]): Unit
    Attributes
    protected[akka]
    Definition Classes
    Timers → Actor
  9. def aroundPreStart(): Unit
    Attributes
    protected[akka]
    Definition Classes
    Actor
    Annotations
    @InternalApi()
  10. def aroundReceive(receive: akka.actor.Actor.Receive, msg: Any): Unit
    Attributes
    protected[akka]
    Definition Classes
    Timers → Actor
  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  13. implicit val context: ActorContext
    Definition Classes
    Actor
  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def getListenerAddress: String
  19. def getListenerPort: Int
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. def initServerSocket(port: Integer): Unit
  22. def initServerSocketDo(port: Integer): Unit
  23. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  24. var masterActor: Option[ActorRef]
  25. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. val onConnectionNewSubscribers: ListBuffer[ActorRef]
  29. def pollForIncomingConnections(socketSelector: Selector): Boolean
  30. def postRestart(reason: Throwable): Unit
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  31. def postStop(): Unit
    Definition Classes
    TcpListener → Actor
  32. def preRestart(reason: Throwable, message: Option[Any]): Unit
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  33. def preStart(): Unit
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  34. def programTimer: Unit
  35. def receive: PartialFunction[Any, Unit]
    Definition Classes
    TcpListener → Actor
  36. implicit final val self: ActorRef
    Definition Classes
    Actor
  37. final def sender(): ActorRef
    Definition Classes
    Actor
  38. var serverSocketChannel: Option[ServerSocketChannel]
  39. var socketSelector: Option[Selector]
  40. def stopListener: Unit
  41. def supervisorStrategy: SupervisorStrategy
    Definition Classes
    Actor
  42. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  43. final def timers: TimerScheduler
    Definition Classes
    Timers
  44. def toString(): String
    Definition Classes
    AnyRef → Any
  45. def unhandled(message: Any): Unit
    Definition Classes
    Actor
  46. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from Timers

Inherited from Actor

Inherited from AnyRef

Inherited from Any

Ungrouped