I am using Source.queue with backpressure as the overflow strategy to create a SourceQueueWithComplete object
I am processing an input csv file , doing some aggregations on it and then offering the rows to the SourceQueueWithComplete.
The offer method of SourceQueueWithComplete returns Future[QueueOfferResult] and because i am producing elements faster than they are consumed at some point you’ll get back QueueOfferResult.Failure
Right now i am doing something akin to
Await.result(queue.offer(group), Duration.Inf) match {
case QueueOfferResult.Enqueued => // ok great
case _ =>
Thread.sleep(10)
retry here..
}
But this strikes me as particularly un-elegant , is there a nicer way to handle offer failures ?