flume icon indicating copy to clipboard operation
flume copied to clipboard

Awaiting disconnection of Receiver or Sender

Open Kijewski opened this issue 1 year ago • 2 comments

I want to do something similar to this:

let msg = select! {
    tx.disconnected() => return Err("disconnected");
    result = read_some_stream() => result?,
};
let msg = process(msg);
if tx.send_async(msg).await.is_err() {
    return Err("disconnected");
}

I.e. I want to asynchronously read from some source, and pass the result to a channel. If the channel gets disconnected in the meantime, I want to know that immediately, not only when I send a message.

Would it be possible to add such a feature? I did try to read the code and to implement it myself, but I failed miserably.

Kijewski avatar Mar 02 '23 15:03 Kijewski