Hello Kasper, I think that having only one entry point for messages exposed in the Actor trait (the receive method) is very flexible. It allows users to build various use case specific implementations. Adding aroundReceive would help to some of the use cases, but it would also add complexity. What if someone would come up with a use case for aroundAroundReceive?
This is use case specific and IMHO should not be generalized. On Mon, Oct 6, 2014 at 4:57 PM, <[email protected]> wrote: > 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 [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. > -- Martynas Mickevičius Typesafe <http://typesafe.com/> – Reactive <http://www.reactivemanifesto.org/> Apps on the JVM -- >>>>>>>>>> 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.
