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.

  • package ronda
p

root package

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.

Ungrouped