On Tue, Jun 28, 2016 at 11:58 AM, Viktor Klang <[email protected]>
wrote:

> Hi Alexey,
>
> How about using ActorSelection until you can't? :)
>
> On Tue, Jun 28, 2016 at 11:31 AM, Alexey Shuksto <[email protected]>
> wrote:
>
>> Hello hAkkers,
>>
>> I have a component, Akka Extension, to be exact, which has one managing
>> actor supervising several "worker" actors ()with different logic and roles).
>>
>> I want to be able to provide users of extension with stable ActorRef's of
>> worker actors:
>>
>> class MyExtension(system: ExtendedActorSystem) extends Extension {
>>   val manager = system actorOf (ManagerActor.props(), "manager")
>>
>>   val actor1: ActorRef = ...
>>   val actor2: ActorRef = ...
>> }
>>
>>
>> I see two ways of doing so:
>>
>>    1. Use ActorSelection instead of ActorRef -- I have stable names and
>>    all selections will be 1-to-1, but still there will be some overhead;
>>    2. Provide users with Future[ActorRef] and let ManagerActor complete
>>    Promise[ActorRef], but than users will always have to deal with Future's
>>    .foreach, .map etc.
>>
>> Surely I don't want to Await till all ActorRef futures is resolved.
>>
>> I think that a good solution would be to wrap Future[ActorRef] as
>> ActorRef instance, that delays all communication till the future is
>> resolved and forwards after that.
>>
>
ActorRef subclasses are not intended to be implemented outside of Akka.

Perhaps you can create a proxy actor for each destination. A real, ordinary
actor. It can handle resolve of selection, buffering, reconnects, and all
kind of fancy things you need.

/Patrik


>
>> The question is -- maybe I'm overlooking some much more simpler and
>> already existent solution?
>>
>> --
>> >>>>>>>>>> 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 https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Cheers,
> √
>
> --
> >>>>>>>>>> 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 https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Patrik Nordwall
Akka Tech Lead
Lightbend <http://www.lightbend.com/> -  Reactive apps on the JVM
Twitter: @patriknw

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to