Is it safe to do something like this:
val (queue, source) = Source.queue[T](bufferSize, OverflowStrategy.backpressure).preMaterialize()
Future {
// in reality, the queue would be passed off somewhere else, where items would be added to the
// queue from a different thread as events come in.
(1...10).foreach(queue.offer(_))
queue.complete()
}
doSomethingWithSource(source)
The documentation isn’t particularly clear on that.