Re: [akka-user] What is the best practice enforce Type Check for Actor during compilation
Thanks, The akka-typed https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fakka%2Fakka%2Fpull%2F16665sa=Dsntz=1usg=AFQjCNGA-XEDn6qAZsuXDu7o-8ayLGXjYw PR is exactly what I want. On Friday, January 23, 2015 at 11:44:25 PM UTC+8, Martynas Mickevičius wrote: Hi Sean, a good practice to define messages that actor handles in actor's companion object. This is of course not enforced by compiler in anyway, but it is good code convention to follow. If you want more compiler help, you may want to check out Typed Actors http://doc.akka.io/docs/akka/2.3.9/scala/typed-actors.html or if you want something fresh and exciting you can take a look at akka-typed https://github.com/akka/akka/pull/16665 which is still in PR form but is going to address the issue you are facing. On Fri, Jan 23, 2015 at 5:21 AM, Sean Zhong cloc...@gmail.com javascript: wrote: Suppose we have a servie actor: class Service extends Actor { def receive: Receive = { case RequestA(args) = doSomething() case RequestB(args) = doAnotherThing() } } // Some client is using RequestA indirectly, like this: class Source(request: RequestA) A client is trying to sending RequestA to service class Client(source: Source) { def query: Unit = { service ? source.request } } Then one day, Service decide to NO longer support RequestA. The above code will still compile as the client doesn't know the Service has changed the interface, and will still send the invalid command. Do you have recommended coding practice to follow, or tools to use, so that it is easir to identity and track this kind of errors? -- 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+...@googlegroups.com javascript:. To post to this group, send email to akka...@googlegroups.com javascript:. 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 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.
Re: [akka-user] What is the best practice enforce Type Check for Actor during compilation
Hi Sean, a good practice to define messages that actor handles in actor's companion object. This is of course not enforced by compiler in anyway, but it is good code convention to follow. If you want more compiler help, you may want to check out Typed Actors http://doc.akka.io/docs/akka/2.3.9/scala/typed-actors.html or if you want something fresh and exciting you can take a look at akka-typed https://github.com/akka/akka/pull/16665 which is still in PR form but is going to address the issue you are facing. On Fri, Jan 23, 2015 at 5:21 AM, Sean Zhong clock...@gmail.com wrote: Suppose we have a servie actor: class Service extends Actor { def receive: Receive = { case RequestA(args) = doSomething() case RequestB(args) = doAnotherThing() } } // Some client is using RequestA indirectly, like this: class Source(request: RequestA) A client is trying to sending RequestA to service class Client(source: Source) { def query: Unit = { service ? source.request } } Then one day, Service decide to NO longer support RequestA. The above code will still compile as the client doesn't know the Service has changed the interface, and will still send the invalid command. Do you have recommended coding practice to follow, or tools to use, so that it is easir to identity and track this kind of errors? -- 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. -- 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 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.
[akka-user] What is the best practice enforce Type Check for Actor during compilation
Suppose we have a servie actor: class Service extends Actor { def receive: Receive = { case RequestA(args) = doSomething() case RequestB(args) = doAnotherThing() } } // Some client is using RequestA indirectly, like this: class Source(request: RequestA) A client is trying to sending RequestA to service class Client(source: Source) { def query: Unit = { service ? source.request } } Then one day, Service decide to NO longer support RequestA. The above code will still compile as the client doesn't know the Service has changed the interface, and will still send the invalid command. Do you have recommended coding practice to follow, or tools to use, so that it is easir to identity and track this kind of errors? -- 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.