Package org.apache.pekko.stream.scaladsl
Interface SourceQueue<T>
-
- All Known Subinterfaces:
SourceQueueWithComplete<T>
public interface SourceQueue<T>
This trait allows to have a queue as a data source for some stream.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description scala.concurrent.Future<QueueOfferResult>
offer(T elem)
Offers an element to a stream and returns aFuture
that: - completes withEnqueued
if the element is consumed by a stream - completes withDropped
when the stream dropped the offered element - completes withQueueClosed
when the stream is completed whilst theFuture
is active - completes withFailure(f)
in case of failure to enqueue element from upstream - fails when stream is already completedscala.concurrent.Future<Done>
watchCompletion()
Returns aFuture
that will be completed if this operator completes, or will be failed when the operator faces an internal failure.
-
-
-
Method Detail
-
offer
scala.concurrent.Future<QueueOfferResult> offer(T elem)
Offers an element to a stream and returns aFuture
that: - completes withEnqueued
if the element is consumed by a stream - completes withDropped
when the stream dropped the offered element - completes withQueueClosed
when the stream is completed whilst theFuture
is active - completes withFailure(f)
in case of failure to enqueue element from upstream - fails when stream is already completedAdditionally when using the backpressure overflowStrategy: - If the buffer is full the
Future
won't be completed until there is space in the buffer - Calling offer before theFuture
is completed, in this case it will return a failedFuture
- Parameters:
elem
- element to send to a stream
-
watchCompletion
scala.concurrent.Future<Done> watchCompletion()
Returns aFuture
that will be completed if this operator completes, or will be failed when the operator faces an internal failure.Note that this only means the elements have been passed downstream, not that downstream has successfully processed them.
-
-