Partially related: CoroutineScope.produce has no way to use a channel with onUndeliveredElement handler. Is
produce
basically on the same deprecation path as actor? Should I roll my own produce if I need
onUndeliveredElement
on the channel?
e
elizarov
05/15/2023, 6:58 AM
Please, submit an issue with with your use-case. The whole support for
onUndeliveredElement
is really a niche feature, so it was not propagated to all of the high-level APIs (e.g. flows don’t support it out-of-the-box either). Btw, it is pretty straightforward to roll out your own version of
produce
that creates a channel with
onUndeliveredElement
.
f
fitermay
05/15/2023, 9:27 AM
I have already made my peace with the fact that flows won’t support leak-free passing of resources. The channel abstraction otoh seems to explicitly support it. So I’d like to use it to dispose of undelivered producer resources in face of cancellation. I will describe I’m issue, as you requested