I've been trying to use the recommended factory method for defining props
as indicated here: http://doc.akka.io/docs/akka/2.2.3/scala/actors.html I
tried it on my own class and it failed with the same type mismatch as seen
below, so I went straight to the demo code using two definitions for props:
import akka.actor.Actor
import akka.actor.Props
object DemoActor {
/**
* Create Props for an actor of this type.
* @param name The name to be passed to this actor’s constructor.
* @return a Props for creating this actor, which can then be further
configured
* (e.g. calling `.withDispatcher()` on it)
*/
def props(name: String): Props = Props(classOf[DemoActor], name)
//def props(name: String): Props = Props(new DemoActor(name))
}
class DemoActor(name: String) extends Actor {
def receive = {
case x ⇒ // some behavior
}
}
The first "props" definition fails a compile time error:
error: type mismatch;
found :
Class[Seven10.hydra.core.scala.DemoActor](classOf[Seven10.hydra.core.scala.DemoActor])
required: () => akka.actor.Actor
def props(name: String): Props = Props(classOf[DemoActor], name)
The 2nd one compiles fine, but from what I read is not
recommended.(https://www.assembla.com/spaces/akka/tickets/3764-doc--revise-advice-for-props-factory-methods#/activity/ticket:)
I'm using Netbeans with the scala plug-in. Any help is appreciated.
--
>>>>>>>>>> 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.