While typically the sender would want to await active receivers, there are some cases where it'd be desirable for sender to not wait but rather not block. One example would be where there are multiple channels to send out to. The use case for using multiple channels would typically be to avoid needlessly waking up tasks that are only interested in the message if it qualifies a certain criteria. Since async-broadcast doesn't provide API for setting up sender-side filters on receivers (with the current implementation, I'm not even sure that's possible), users will have to split up the channels, one for each filter. There may also be other use cases.
Two solutions come to mind:
We extend the scope of overflow mode. When it's set to true, Sender doesn't wait for active receivers and just drops the message.
Introduce a new await-active-receiver mode that when set, means Sender not waiting for active receivers. The question would be if broadcast should just succeed when there are no active receivers of error out, in case sender wanted the message back if nobody could receive it? I'm leaning towards the latter.
While typically the sender would want to await active receivers, there are some cases where it'd be desirable for sender to not wait but rather not block. One example would be where there are multiple channels to send out to. The use case for using multiple channels would typically be to avoid needlessly waking up tasks that are only interested in the message if it qualifies a certain criteria. Since async-broadcast doesn't provide API for setting up sender-side filters on receivers (with the current implementation, I'm not even sure that's possible), users will have to split up the channels, one for each filter. There may also be other use cases.
Two solutions come to mind:
overflow
mode. When it's set totrue
, Sender doesn't wait for active receivers and just drops the message.await-active-receiver
mode that when set, means Sender not waiting for active receivers. The question would be ifbroadcast
should just succeed when there are no active receivers of error out, in case sender wanted the message back if nobody could receive it? I'm leaning towards the latter.