Skip to content

Instantly share code, notes, and snippets.

@Centaur
Created December 16, 2013 08:11
Show Gist options
  • Save Centaur/7983761 to your computer and use it in GitHub Desktop.
Save Centaur/7983761 to your computer and use it in GitHub Desktop.
import akka.actor._
import scala.concurrent.duration.Duration
trait CommonReceive extends Actor {
def commonReceive: Receive = {
case "Mesage" => //
}
abstract override def receive = super.receive orElse commonReceive
abstract override def context = new ActorContext {
def unwatch(subject: ActorRef) = CommonReceive.super.context.unwatch(subject)
def children = CommonReceive.super.context.children
def become(behavior: Actor.Receive, discardOld: Boolean = true) = CommonReceive.super.context.become(behavior orElse commonReceive, discardOld)
def stop(actor: ActorRef) = CommonReceive.super.context.stop(actor)
def receiveTimeout = CommonReceive.super.context.receiveTimeout
protected def lookupRoot = CommonReceive.super.context.lookupRoot
def props = CommonReceive.super.context.props
def unbecome() = CommonReceive.super.context.unbecome()
def watch(subject: ActorRef) = CommonReceive.super.context.watch(subject)
protected def provider = CommonReceive.super.context.provider
def child(name: String) = CommonReceive.super.context.child(name)
def self = CommonReceive.super.context.self
protected def guardian = CommonReceive.super.context.guardian
def setReceiveTimeout(timeout: Duration) = CommonReceive.super.context.guardian
protected def systemImpl = CommonReceive.super.context.systemImpl
implicit def dispatcher = CommonReceive.super.context.dispatcher
def sender = CommonReceive.super.context.sender
def actorOf(props: Props, name: String) = CommonReceive.super.context.actorOf(props, name)
def actorOf(props: Props) = CommonReceive.super.context.actorOf(props)
def parent = CommonReceive.super.context.parent
implicit def system = CommonReceive.super.context.system
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment