CodeLionX / actordb

Actor Database System Framework using Akka
MIT License
0 stars 2 forks source link

Add .dactorSelection to Dactor companion object #55

Closed srfc closed 6 years ago

srfc commented 6 years ago

Proposed Changes

// you can use this selection to send messages selection ! MyDactorSubclass.SomeMessage.Request()

  - being able to do the above is useful for testing and possibly during startup initialization

  - and you can get back an `ActorRef` if you absolutely have to like this:
```scala
val future = Dactor.dactorSelection(actorSystem, classOf[MyDactorSubclass], idFormerlyKnownAsName).resolveOne()

// you can do this to check if an actor actually exists
future onComplete {
  case Success(actor) => doSomethingWithActor(actor)
  case Failure(e: ActorNotFound) => handleError(e)
}

Related

srfc commented 6 years ago

What will we actually use the Dactor class member methods dactorOf and dactorSelection for? The way I see it it is not going to be typical for us to handle the Dactor instances directly. What use case did you intend them for, @CodeLionX ?

Edit: Don't mind me... got it.