Hi Rafał,

I have a source as val userSource = Source.actorRef(10, OverflowStrategy.
fail).mapMaterializedValue(connected())), and a sink as val userSink = Sink.
actorRef[NotifyEnvelope](usrActor, disconnect())

And I printed the log in the connected() and the disconnect(), but found 
out when the connection was established, the disconnect() always be called 
first, then the connected(). Thus if I use the counter in the disconnect() 
and connected(), the counter will be not correct. Do you know any 
information about why disconnect() will be called first then the 
connected()?

p.s.: I have confirmed the connection was established correctly.

Many thanks,
Leo

Rafał Krzewski於 2017年3月5日星期日 UTC+8下午5時27分38秒寫道:
>
> Hi Leo,
>
> The actor is created each time you materialize a new instance of your 
> stream, which is something your application code does explicitly. 
> Materializing the stream yields and ActorRef that you can send to a 
> dedicated tracking actor.
> Each time it receives and ActorRef, it increments an internal counter and 
> starts to watch that ActorRef. Each time it receives a Terminated message 
> it decrements the counter. Finally, each time it receives a dedicated 
> ReturnCount message it responds with current value of the counter.
>
> Cheers,
> Rafał
>
> W dniu czwartek, 2 marca 2017 12:00:00 UTC+1 użytkownik Leo Wolf napisał:
>>
>> Hi,
>>
>> I have a question about how to measure the number of source actors with 
>> akka stream?
>> In code of akka stream, we can use Source.actorRef to create souce actor 
>> for akka streaming, but is there any way to get the number of created 
>> actors rather than calculate it in code of akka stream? Since every 
>> actor has a supervisor for it, can I get the number of created source 
>> actors by the supervisor? If yes, then how? Thanks for the help!
>>
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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