is there any way to poll/receive from a channel wi...
# coroutines
d
is there any way to poll/receive from a channel without consuming the element? like peeking at the front of a queue
v
Nope. Could you please elaborate why do you need it?
d
I'm trying to invoke a method as soon as a message is received in a channel, but without actually caring what the message is - so that I can consume the message later. It's hard to explain - that's probably because I just designed it poorly
l
@Daniel Tam Maybe you need to use two channels, one for each purpose (notifying, and consuming)? Or use one channel, and some custom logic?
w
Yea you could use a relay type situation where you
actor
consumes the element in order to kick your functionality, then sends the element down another channel for later consumption. Alternatively use a broadcast channel so two different things can open a subscription and both receive all elements.
d
Ah I do like the idea of a broadcast channel