Package

de.knutwalker

akka

Permalink

package akka

Visibility
  1. Public
  2. All

Value Members

  1. package typed

    Permalink

    Compile-time wrapper for akka.actor.ActorRef to allow for same degree of type-safety on actors without requiring too much changes to the underlying system.

    Compile-time wrapper for akka.actor.ActorRef to allow for same degree of type-safety on actors without requiring too much changes to the underlying system.

    Example:

    import akka.actor._
    import de.knutwalker.akka.typed._
    
    case class Ping(replyTo: ActorRef[Pong])
    case class Pong(replyTo: ActorRef[Ping])
    
    implicit val system = ActorSystem()
    
    val ping: ActorRef[Ping] = ActorOf(PropsOf[Ping](new Actor {
      def receive: Receive = {
        case Ping(replyTo) ⇒ replyTo ! Pong(self.typed)
      }
    }))
    val pong: ActorRef[Pong] = ActorOf(PropsOf[Pong](new Actor {
      def receive: Receive = {
        case Pong(replyTo) ⇒ replyTo ! Ping(self.typed)
      }
    }))
    
    ping ! Ping(pong)
    
    
    system.shutdown()

Ungrouped