apache / pekko

Build highly concurrent, distributed, and resilient message-driven applications using Java/Scala
https://pekko.apache.org/
Apache License 2.0
1.18k stars 142 forks source link

Feature request: Add BoundedSourceQueue#isComplete method #1356

Closed He-Pin closed 3 months ago

He-Pin commented 4 months ago

Motivation: I want to do a checking before enqueue or call complete with a check otherwise it will throw an exception .

@InternalApi private[pekko] object BoundedSourceQueueStage {
  sealed trait State
  case object NeedsActivation extends State
  case object Running extends State
  case class Done(result: QueueCompletionResult) extends State
}

Modification: Add BoundedSourceQueue#isComplete method.

Cons: But that will introduce another check, hurt performance for real usage.

Update: Checked reactor-core too, which doesn't provides something like this too.