Sorry guys, Router is immutable with internal immutable val routees: immutable. IndexedSeq[Routee]. So we can create a temp val from current state of Router and check routees before send a message.
On Tuesday, June 23, 2015 at 10:46:03 AM UTC+2, ovsyannikov vladimir wrote: > > Hi, > > Sorry for a repetition, but I've not idea there's my previous post. > > So in my lib I add/remove routee to a router dynamicly(a routee represents > a socket connection). Could be a scenario when there's no available > ActorRef that is able to handle message. In that case I'm going to return > an exception. > > Unfortunately there's no way to get ActorRef from a Router(or > Option[ActorRef]) or send it with result(like tryRoute(message: Any, > sender: ActorRef): Boolean). > > Plus current implementation just swallow messages in case of routee == > NoRoutee > > > https://github.com/akka/akka/blob/v2.3.11/akka-actor/src/main/scala/akka/routing/Router.scala#L113-L124 > > https://github.com/akka/akka/blob/v2.3.11/akka-actor/src/main/scala/akka/routing/Router.scala#L61-L63 > > From my point of view empty router is an exceptional situation. And > swallowing exceptions is not a good design/practice. > > > -- >>>>>>>>>> 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.
