Many thanks for the tips. However could you tell me if it is scattered
around or there is a special place that talks about that ? If yes could you
point me to it.
The thing is i have been working with books. I'm working with scala
cookbook, scalation in action which both have chapter on it, I recently
bought Akka in action (MEAP), and someone gave me effective AKKA. Although,
i search and it is only, Akka in action which talk about creating a
protocol object which contain those message. However nothing as fancy as
yours with sealed trait and etc...
On Friday, January 3, 2014 11:25:29 AM UTC+1, rkuhn wrote:
>
> Hi Maatary,
>
> if you look at the Akka documentation or browse for blog posts you’ll see
> that usually the message types accepted and emitted by an actor are
> declared together with it—in the same package or in its companion object.
> These messages are a perfect match for case classes since they need to be
> immutable and should have appropriate deconstructors for pattern matching:
>
> object MyActor {
> sealed trait Command
> case class DoIt(name: String, id: Int) extends Command
> ... // further commands
>
> sealed trait Reply
> case object Done extends Reply
> }
>
> class MyActor extends Actor {
> def receive = {
> case DoIt(name, id) =>
> // do it
> sender ! Done
> ... // further cases
> }
> }
>
> Regards,
>
> Roland
>
> 2 jan 2014 kl. 03:22 skrev Maatary Okouya <[email protected]<javascript:>
> >:
>
> Hi,
>
> I just start trying myself out with Scala. I grow confident enough to
> start refactoring an ongoing multi-threaded application that i have been
> working on for about a year and half.
>
> However something that somehow bother and i can't somehow figure it out,
> is how to expose the interface/contract/protocole of an Actor? In the OO
> mode, i have my public interface with synchronized method if necessary, and
> i know what i can do with that object. Now that i'm going to use actor, it
> seems that all of that won't be available anymore.
>
> More specifically, I a KbService in my app with a set of method to work
> with that Kb. I want to make it an actor on its own. For that i need to
> make all the method private or protected given that now they will be only
> called by my received method. Hence the to expose the set of available
> behavior.
>
> Is there some best practice for that ?
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
> >>>>>>>>>> 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] <javascript:>.
> To post to this group, send email to [email protected]<javascript:>
> .
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> *Dr. Roland Kuhn*
> *Akka Tech Lead*
> Typesafe <http://typesafe.com/> – Reactive apps on the JVM.
> twitter: @rolandkuhn
> <http://twitter.com/#!/rolandkuhn>
>
>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> 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/groups/opt_out.