https://kotlinlang.org logo
#coroutines
Title
# coroutines
a

Alexey V Golubev

11/24/2019, 9:31 AM
What is the right way to get a count of pending messages in actor’s “mailbox” from outside? Should I expose its
ReceiveChannel
and do something like
channel.asFlow().count()
?
b

bohsen

11/25/2019, 7:17 AM
I wouldn't expose the
ReceiveChannel
to the caller, as the
ReceiveChannel
is cancellable. I'd rather add a property to the actor:
Copy code
val count = channel.asFlow().count()
a

Alexey V Golubev

11/25/2019, 12:09 PM
Thanks, I was thinking in the same direction
👍 1
13 Views