In my application, I have an Actor
whose behavior involves offering an element into a SourceQueueWithCompletion
for each message received by that Actor
. If I use backpressure as the overflow strategy in the SourceQueue
, it is my understanding that attempts to offer
an item will result in a failed Future
if there is already another offer
pending (waiting for space in the queue). I should add that maxConcurrentOffers
on the queue is set to 1.
If I were to choose a different overflow strategy, such as dropHead
or dropTail
, I believe that my application would have no way of knowing that any items in the queue have been dropped. Am I correct about that?
Would it be a reasonable enhancement request for some kind of overflow notification mechanism to be added to SourceQueue
? For example, there could me a method watchForOverflow
that returns a Future[OverflowNotification]
that would complete if any item is ever dropped from the queue (or if the queue is closed).
As an alternative to that, would it be reasonable for SourceQueue
to have a method to inquire about the current number of elements in the queue, so that my application could know that a subsequent call to offer
might trigger an overflow? I realize that it would be impossible for this inquiry to guarantee anything about what a subsequent offer
would do, but it would at least allow me to monitor whether I have configured my SourceQueue
size appropriately.