What is the right way to get a count of pending me...
# coroutines
a
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
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
Thanks, I was thinking in the same direction
👍 1