Hi

I have been looking at the implementation of akka persistence and would 
like to implement some of our functionality in a similar way (batching some 
messages for our storage created during the receive method and send them in 
one batch after receive, and executing a handler when storage has been 
confirmed).

Our problem is that the aroundReceive method in Actor is protected[akka]. I 
think it might be of value to provide an trait to be able to do some stuff 
before and after the receive method is called. 

We can of course implement the trait our self but think it might be of 
value to others. Furthermore it would be good to know that we can continue 
rely on the before and after methods and not worry that the internal api in 
Akka changes. 

The trait could be something like this:


trait BeforeAndAfterReceive extends Actor{
  override protected[akka] def aroundReceive(receive: Receive, msg: Any) = {
    if(beforeReceive(receive, msg)) {
      super.aroundReceive(receive, msg)
      afterReceive(receive, msg)
    }


  }
  def beforeReceive(receive: Receive, msg: Any):Boolean
  def afterReceive(receive: Receive, msg: Any):Unit
}

Are there any pitfalls using this approach or other suggestions to 
implement the batching .

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to