Hi,
Currently my actor becomes ready when it receives a msg :
class MyActor {
private val mediator =
DistributedPubSubExtension(context.system).mediator
mediator ! Subscribe(Subscriptions.Index, self)
...
override def receive = {
case SubscribeAck(Subscribe(Subscriptions.Index, None, self)) =>
context become ready
}
def ready =
createPart.receive orElse
retrievePart.receive
}
This creates problems in test cases, when I send a msg to my actor:
myActor ! Create(...) // this is received before SubscribeAck and hence it
is ignored
My temp solution is to sleep a bit after creating an actor so that I give
an opportunity to the mediator to send the SubscribeAck:
val indexActor = system.actorOf(Props(IndexActor.empty(IntKey,
StringValue, cluster.ref)))
// TODO: replace this with something better. This is required so
that the actor becomes ready
Thread.sleep(5)
Is there a better solution?
Thanks
#
--
>>>>>>>>>> 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.