Hi,
Assuming I want to do some aop advice against some of the actor method like
ask , tell, etc like:
@Around(value = "execution (* akka.actor.ScalaActorRef.$bang(..)) &&
args(message,sender)", argNames = "jp,message,sender")
def handle(jp: ProceedingJoinPoint, message: AnyRef, sender: ActorRef) {
val args = jp.getArgs
val thisActor = jp.getThis.asInstanceOf[ActorRef]
(message, sender) match {
case (PoisonPill,_) =>
case (Terminated(_),_) =>
case (ReceiveTimeout,_) =>
case (msg, sender) if NoNeedToDoAnyThing =>
case (msg, sender) =>
args(0) = msg match {
case a : ClassA =>
ClassA(msg)
case b : ClassB =>
ClassB(msg)
case any =>
WrapperAny(msg)
}
}
jp.proceed(args)
}
I'm wondering is there any "Scala" way of doing it, since I saw some one
said that the functional programming nature of scala was born to support
AOP.
In that case, I don't need to introduce 3rd party AOP dependency like
AspectJ and do it in traditional way.
Thanks in advance!
Leon
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.