Packages

object Source

Source
Source.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Source
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def actorRef[T](completionMatcher: PartialFunction[Any, CompletionStrategy], failureMatcher: PartialFunction[Any, Throwable], bufferSize: Int, overflowStrategy: OverflowStrategy): Source[T, ActorRef]

    Creates a Source that is materialized as an akka.actor.ActorRef.

    Creates a Source that is materialized as an akka.actor.ActorRef. Messages sent to this actor will be emitted to the stream if there is demand from downstream, otherwise they will be buffered until request for demand is received.

    Depending on the defined akka.stream.OverflowStrategy it might drop elements if there is no space available in the buffer.

    The strategy akka.stream.OverflowStrategy.backpressure is not supported, and an IllegalArgument("Backpressure overflowStrategy not supported") will be thrown if it is passed as argument.

    The buffer can be disabled by using bufferSize of 0 and then received messages are dropped if there is no demand from downstream. When bufferSize is 0 the overflowStrategy does not matter.

    The stream can be completed successfully by sending the actor reference a message that is matched by completionMatcher in which case already buffered elements will be signaled before signaling completion.

    The stream can be completed with failure by sending a message that is matched by failureMatcher. The extracted Throwable will be used to fail the stream. In case the Actor is still draining its internal buffer (after having received a message matched by completionMatcher) before signaling completion and it receives a message matched by failureMatcher, the failure will be signaled downstream immediately (instead of the completion signal).

    Note that terminating the actor without first completing it, either with a success or a failure, will prevent the actor triggering downstream completion and the stream will continue to run even though the source actor is dead. Therefore you should **not** attempt to manually terminate the actor such as with a akka.actor.PoisonPill.

    The actor will be stopped when the stream is completed, failed or canceled from downstream, i.e. you can watch it to get notified when that happens.

    See also akka.stream.scaladsl.Source.queue.

    completionMatcher

    catches the completion message to end the stream

    failureMatcher

    catches the failure message to fail the stream

    bufferSize

    The size of the buffer in element count

    overflowStrategy

    Strategy that is used when incoming elements cannot fit inside the buffer

  5. def actorRefWithBackpressure[T](ackMessage: Any, completionMatcher: PartialFunction[Any, CompletionStrategy], failureMatcher: PartialFunction[Any, Throwable]): Source[T, ActorRef]

    Creates a Source that is materialized as an akka.actor.ActorRef.

    Creates a Source that is materialized as an akka.actor.ActorRef. Messages sent to this actor will be emitted to the stream if there is demand from downstream, and a new message will only be accepted after the previous messages has been consumed and acknowledged back. The stream will complete with failure if a message is sent before the acknowledgement has been replied back.

    The stream can be completed with failure by sending a message that is matched by failureMatcher. The extracted Throwable will be used to fail the stream. In case the Actor is still draining its internal buffer (after having received a message matched by completionMatcher) before signaling completion and it receives a message matched by failureMatcher, the failure will be signaled downstream immediately (instead of the completion signal).

    The actor will be stopped when the stream is completed, failed or canceled from downstream, i.e. you can watch it to get notified when that happens.

  6. def apply[T](iterable: Iterable[T]): Source[T, NotUsed]

    Helper to create Source from Iterable.

    Helper to create Source from Iterable. Example usage: Source(Seq(1,2,3))

    Starts a new Source from the given Iterable. This is like starting from an Iterator, but every Subscriber directly attached to the Publisher of this stream will see an individual flow of elements (always starting from the beginning) regardless of when they subscribed.

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def asSubscriber[T]: Source[T, Subscriber[T]]

    Creates a Source that is materialized as a org.reactivestreams.Subscriber

  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  10. def combine[T, U, M](sources: Seq[Graph[SourceShape[T], M]])(fanInStrategy: (Int) => Graph[UniformFanInShape[T, U], NotUsed]): Source[U, Seq[M]]

    Combines several sources with fan-in strategy like Merge or Concat into a single Source.

  11. def combine[T, U](first: Source[T, _], second: Source[T, _], rest: Source[T, _]*)(fanInStrategy: (Int) => Graph[UniformFanInShape[T, U], NotUsed]): Source[U, NotUsed]

    Combines several sources with fan-in strategy like Merge or Concat into a single Source.

  12. def combineMat[T, U, M1, M2, M](first: Source[T, M1], second: Source[T, M2])(fanInStrategy: (Int) => Graph[UniformFanInShape[T, U], NotUsed])(matF: (M1, M2) => M): Source[U, M]

    Combines two sources with fan-in strategy like Merge or Concat into a single Source with a materialized value.

  13. def completionStage[T](completionStage: CompletionStage[T]): Source[T, NotUsed]

    Emits a single value when the given CompletionStage is successfully completed and then completes the stream.

    Emits a single value when the given CompletionStage is successfully completed and then completes the stream. If the CompletionStage is completed with a failure the stream is failed.

    Here for Java interoperability, the normal use from Scala should be Source.future

  14. def cycle[T](f: () => Iterator[T]): Source[T, NotUsed]

    Creates a Source that will continually produce elements in the order they are provided.

    Creates a Source that will continually produce elements in the order they are provided.

    The following example produces a Source that repeatedly cycles through the integers from 0 to 9:

    Source.cycle(() => Iterator.range(0, 10))

    The function f is invoked to obtain an Iterator and elements are emitted into the stream as provided by that iterator. If the iterator is finite, the function f invoked again, as necessary, when the elements from the previous iteration are exhausted. If every call to the function f returns an iterator that produces the same elements in the same order, then the Source can be described as cyclic. However, f is not required to behave that way, in which case the Source will not be cyclic.

    The Source fails if f returns an empty iterator.

  15. def empty[T]: Source[T, NotUsed]

    A Source with no elements, i.e.

    A Source with no elements, i.e. an empty stream that is completed immediately for every connected Sink.

  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  18. def failed[T](cause: Throwable): Source[T, NotUsed]

    Create a Source that immediately ends the stream with the cause error to every connected Sink.

  19. def fromGraph[T, M](g: Graph[SourceShape[T], M]): Source[T, M]

    A graph with the shape of a source logically is a source, this method makes it so also in type.

  20. def fromIterator[T](f: () => Iterator[T]): Source[T, NotUsed]

    Helper to create a Source from an Iterator.

    Helper to create a Source from an Iterator.

    Example usage: Source.fromIterator(() => Iterator.from(0))

    Start a new Source from the given function that produces an Iterator. The produced stream of elements will continue until the iterator runs empty or fails during evaluation of the next() method. Elements are pulled out of the iterator in accordance with the demand coming from the downstream transformation steps.

  21. def fromJavaStream[T, S <: BaseStream[T, S]](stream: () => BaseStream[T, S]): Source[T, NotUsed]

    Creates a source that wraps a Java 8 Stream.

    Creates a source that wraps a Java 8 Stream. Source uses a stream iterator to get all its elements and send them downstream on demand.

    You can use Source.async to create asynchronous boundaries between synchronous Java Stream and the rest of flow.

  22. def fromMaterializer[T, M](factory: (Materializer, Attributes) => Source[T, M]): Source[T, Future[M]]

    Defers the creation of a Source until materialization.

    Defers the creation of a Source until materialization. The factory function exposes Materializer which is going to be used during materialization and Attributes of the Source returned by this method.

  23. def fromPublisher[T](publisher: Publisher[T]): Source[T, NotUsed]

    Helper to create Source from Publisher.

    Helper to create Source from Publisher.

    Construct a transformation starting with given publisher. The transformation steps are executed by a series of org.reactivestreams.Processor instances that mediate the flow of elements downstream and the propagation of back-pressure upstream.

  24. def future[T](futureElement: Future[T]): Source[T, NotUsed]

    Emits a single value when the given Future is successfully completed and then completes the stream.

    Emits a single value when the given Future is successfully completed and then completes the stream. The stream fails if the Future is completed with a failure.

  25. def futureSource[T, M](futureSource: Future[Source[T, M]]): Source[T, Future[M]]

    Turn a Future[Source] into a source that will emit the values of the source when the future completes successfully.

    Turn a Future[Source] into a source that will emit the values of the source when the future completes successfully. If the Future is completed with a failure the stream is failed.

  26. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  27. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  28. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  29. def lazyFuture[T](create: () => Future[T]): Source[T, NotUsed]

    Defers invoking the create function to create a future element until there is downstream demand.

    Defers invoking the create function to create a future element until there is downstream demand.

    The returned future element will be emitted downstream when it completes, or fail the stream if the future is failed or the create function itself fails.

    Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts the laziness and will trigger the factory immediately.

  30. def lazyFutureSource[T, M](create: () => Future[Source[T, M]]): Source[T, Future[M]]

    Defers invoking the create function to create a future source until there is downstream demand.

    Defers invoking the create function to create a future source until there is downstream demand.

    The returned future source will emit downstream and behave just like it was the outer source when the future completes successfully. Downstream completes when the created source completes and fails when the created source fails. If the future or the create function fails the stream is failed.

    Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts the laziness and triggers the factory immediately.

    The materialized future value is completed with the materialized value of the created source when it has been materialized. If the function throws or the source materialization fails the future materialized value is failed with the thrown exception.

    If downstream cancels or fails before the function is invoked the materialized value is failed with a akka.stream.NeverMaterializedException

  31. def lazySingle[T](create: () => T): Source[T, NotUsed]

    Defers invoking the create function to create a single element until there is downstream demand.

    Defers invoking the create function to create a single element until there is downstream demand.

    If the create function fails when invoked the stream is failed.

    Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts the laziness and will trigger the factory immediately.

  32. def lazySource[T, M](create: () => Source[T, M]): Source[T, Future[M]]

    Defers invoking the create function to create a future source until there is downstream demand.

    Defers invoking the create function to create a future source until there is downstream demand.

    The returned source will emit downstream and behave just like it was the outer source. Downstream completes when the created source completes and fails when the created source fails.

    Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts the laziness and will trigger the factory immediately.

    The materialized future value is completed with the materialized value of the created source when it has been materialized. If the function throws or the source materialization fails the future materialized value is failed with the thrown exception.

    If downstream cancels or fails before the function is invoked the materialized value is failed with a akka.stream.NeverMaterializedException

  33. def maybe[T]: Source[T, Promise[Option[T]]]

    Create a Source which materializes a scala.concurrent.Promise which controls what element will be emitted by the Source.

    Create a Source which materializes a scala.concurrent.Promise which controls what element will be emitted by the Source. If the materialized promise is completed with a Some, that value will be produced downstream, followed by completion. If the materialized promise is completed with a None, no value will be produced downstream and completion will be signalled immediately. If the materialized promise is completed with a failure, then the source will fail with that error. If the downstream of this source cancels or fails before the promise has been completed, then the promise will be completed with None.

  34. def mergePrioritizedN[T](sourcesAndPriorities: Seq[(Source[T, _], Int)], eagerComplete: Boolean): Source[T, NotUsed]

    Merge multiple Sources.

    Merge multiple Sources. Prefer the sources depending on the 'priority' parameters. The provided sources and priorities must have the same size and order.

    emits when one of the inputs has an element available, preferring inputs based on the 'priority' parameters if both have elements available

    backpressures when downstream backpressures

    completes when both upstreams complete (This behavior is changeable to completing when any upstream completes by setting eagerComplete=true.)

    Cancels when downstream cancels

  35. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  36. def never[T]: Source[T, NotUsed]

    Never emits any elements, never completes and never fails.

    Never emits any elements, never completes and never fails. This stream could be useful in tests.

  37. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  38. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  39. def queue[T](bufferSize: Int, overflowStrategy: OverflowStrategy, maxConcurrentOffers: Int): Source[T, SourceQueueWithComplete[T]]

    Creates a Source that is materialized as an akka.stream.scaladsl.SourceQueueWithComplete.

    Creates a Source that is materialized as an akka.stream.scaladsl.SourceQueueWithComplete. You can push elements to the queue and they will be emitted to the stream if there is demand from downstream, otherwise they will be buffered until request for demand is received. Elements in the buffer will be discarded if downstream is terminated.

    Depending on the defined akka.stream.OverflowStrategy it might drop elements if there is no space available in the buffer.

    Acknowledgement mechanism is available. akka.stream.scaladsl.SourceQueueWithComplete.offer returns Future[QueueOfferResult] which completes with QueueOfferResult.Enqueued if element was added to buffer or sent downstream. It completes with QueueOfferResult.Dropped if element was dropped. Can also complete with QueueOfferResult.Failure - when stream failed or QueueOfferResult.QueueClosed when downstream is completed.

    The strategy akka.stream.OverflowStrategy.backpressure will not complete maxConcurrentOffers number of offer():Future call when buffer is full.

    Instead of using the strategy akka.stream.OverflowStrategy.dropNew it's recommended to use Source.queue(bufferSize) instead which returns a QueueOfferResult synchronously.

    You can watch accessibility of stream with akka.stream.scaladsl.SourceQueueWithComplete.watchCompletion. It returns future that completes with success when the operator is completed or fails when the stream is failed.

    The buffer can be disabled by using bufferSize of 0 and then received message will wait for downstream demand unless there is another message waiting for downstream demand, in that case offer result will be completed according to the overflow strategy.

    The materialized SourceQueue may be used by up to maxConcurrentOffers concurrent producers.

    bufferSize

    size of buffer in element count

    overflowStrategy

    Strategy that is used when incoming elements cannot fit inside the buffer

    maxConcurrentOffers

    maximum number of pending offers when buffer is full, should be greater than 0, not applicable when OverflowStrategy.dropNew is used

  40. def queue[T](bufferSize: Int, overflowStrategy: OverflowStrategy): Source[T, SourceQueueWithComplete[T]]

    Creates a Source that is materialized as an akka.stream.scaladsl.SourceQueueWithComplete.

    Creates a Source that is materialized as an akka.stream.scaladsl.SourceQueueWithComplete. You can push elements to the queue and they will be emitted to the stream if there is demand from downstream, otherwise they will be buffered until request for demand is received. Elements in the buffer will be discarded if downstream is terminated.

    Depending on the defined akka.stream.OverflowStrategy it might drop elements if there is no space available in the buffer.

    Acknowledgement mechanism is available. akka.stream.scaladsl.SourceQueueWithComplete.offer returns Future[QueueOfferResult] which completes with QueueOfferResult.Enqueued if element was added to buffer or sent downstream. It completes with QueueOfferResult.Dropped if element was dropped. Can also complete with QueueOfferResult.Failure - when stream failed or QueueOfferResult.QueueClosed when downstream is completed.

    The strategy akka.stream.OverflowStrategy.backpressure will not complete last offer():Future call when buffer is full.

    Instead of using the strategy akka.stream.OverflowStrategy.dropNew it's recommended to use Source.queue(bufferSize) instead which returns a QueueOfferResult synchronously.

    You can watch accessibility of stream with akka.stream.scaladsl.SourceQueueWithComplete.watchCompletion. It returns future that completes with success when the operator is completed or fails when the stream is failed.

    The buffer can be disabled by using bufferSize of 0 and then received message will wait for downstream demand unless there is another message waiting for downstream demand, in that case offer result will be completed according to the overflow strategy.

    The materialized SourceQueue may only be used from a single producer.

    bufferSize

    size of buffer in element count

    overflowStrategy

    Strategy that is used when incoming elements cannot fit inside the buffer

  41. def queue[T](bufferSize: Int): Source[T, BoundedSourceQueue[T]]

    Creates a Source that is materialized as an akka.stream.BoundedSourceQueue.

    Creates a Source that is materialized as an akka.stream.BoundedSourceQueue. You can push elements to the queue and they will be emitted to the stream if there is demand from downstream, otherwise they will be buffered until request for demand is received. The buffer size is passed in as a parameter. Elements in the buffer will be discarded if downstream is terminated.

    Pushed elements may be dropped if there is no space available in the buffer. Elements will also be dropped if the queue is failed through the materialized BoundedQueueSource or the Source is cancelled by the downstream. An element that was reported to be enqueued is not guaranteed to be processed by the rest of the stream. If the queue is failed by calling BoundedQueueSource.fail or the downstream cancels the stream, elements in the buffer are discarded.

    Acknowledgement of pushed elements is immediate. akka.stream.BoundedSourceQueue.offer returns akka.stream.QueueOfferResult which is implemented as:

    QueueOfferResult.Enqueued element was added to buffer, but may still be discarded later when the queue is failed or cancelled QueueOfferResult.Dropped element was dropped QueueOfferResult.QueueComplete the queue was completed with akka.stream.BoundedSourceQueue.complete QueueOfferResult.Failure the queue was failed with akka.stream.BoundedSourceQueue.fail or if the stream failed

    bufferSize

    size of the buffer in number of elements

  42. def repeat[T](element: T): Source[T, NotUsed]

    Create a Source that will continually emit the given element.

  43. def shape[T](name: String): SourceShape[T]

    INTERNAL API

  44. def single[T](element: T): Source[T, NotUsed]

    Create a Source with one element.

    Create a Source with one element. Every connected Sink of this stream will see an individual stream consisting of one element.

  45. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  46. def tick[T](initialDelay: FiniteDuration, interval: FiniteDuration, tick: T): Source[T, Cancellable]

    Elements are emitted periodically with the specified interval.

    Elements are emitted periodically with the specified interval. The tick element will be delivered to downstream consumers that has requested any elements. If a consumer has not requested any elements at the point in time when the tick element is produced it will not receive that tick element later. It will receive new tick elements as soon as it has requested more elements.

  47. def toString(): String
    Definition Classes
    AnyRef → Any
  48. def unfold[S, E](s: S)(f: (S) => Option[(S, E)]): Source[E, NotUsed]

    Create a Source that will unfold a value of type S into a pair of the next state S and output elements of type E.

    Create a Source that will unfold a value of type S into a pair of the next state S and output elements of type E.

    For example, all the Fibonacci numbers under 10M:

    Source.unfold(0 -> 1) {
     case (a, _) if a > 10000000 => None
     case (a, b) => Some((b -> (a + b)) -> a)
    }
  49. def unfoldAsync[S, E](s: S)(f: (S) => Future[Option[(S, E)]]): Source[E, NotUsed]

    Same as unfold, but uses an async function to generate the next state-element tuple.

    Same as unfold, but uses an async function to generate the next state-element tuple.

    async fibonacci example:

    Source.unfoldAsync(0 -> 1) {
     case (a, _) if a > 10000000 => Future.successful(None)
     case (a, b) => Future{
       Thread.sleep(1000)
       Some((b -> (a + b)) -> a)
     }
    }
  50. def unfoldResource[T, S](create: () => S, read: (S) => Option[T], close: (S) => Unit): Source[T, NotUsed]

    Start a new Source from some resource which can be opened, read and closed.

    Start a new Source from some resource which can be opened, read and closed. Interaction with resource happens in a blocking way.

    Example:

    Source.unfoldResource(
      () => new BufferedReader(new FileReader("...")),
      reader => Option(reader.readLine()),
      reader => reader.close())

    You can use the supervision strategy to handle exceptions for read function. All exceptions thrown by create or close will fail the stream.

    Restart supervision strategy will close and create blocking IO again. Default strategy is Stop which means that stream will be terminated on error in read function by default.

    You can configure the default dispatcher for this Source by changing the akka.stream.materializer.blocking-io-dispatcher or set it for a given Source by using ActorAttributes.

    Adheres to the ActorAttributes.SupervisionStrategy attribute.

    create

    - function that is called on stream start and creates/opens resource.

    read

    - function that reads data from opened resource. It is called each time backpressure signal is received. Stream calls close and completes when read returns None.

    close

    - function that closes resource

  51. def unfoldResourceAsync[T, S](create: () => Future[S], read: (S) => Future[Option[T]], close: (S) => Future[Done]): Source[T, NotUsed]

    Start a new Source from some resource which can be opened, read and closed.

    Start a new Source from some resource which can be opened, read and closed. It's similar to unfoldResource but takes functions that return Futures instead of plain values.

    You can use the supervision strategy to handle exceptions for read function or failures of produced Futures. All exceptions thrown by create or close as well as fails of returned futures will fail the stream.

    Restart supervision strategy will close and create resource. Default strategy is Stop which means that stream will be terminated on error in read function (or future) by default.

    You can configure the default dispatcher for this Source by changing the akka.stream.materializer.blocking-io-dispatcher or set it for a given Source by using ActorAttributes.

    Adheres to the ActorAttributes.SupervisionStrategy attribute.

    create

    - function that is called on stream start and creates/opens resource.

    read

    - function that reads data from opened resource. It is called each time backpressure signal is received. Stream calls close and completes when Future from read function returns None.

    close

    - function that closes resource

  52. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  53. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  54. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  55. def zipN[T](sources: Seq[Source[T, _]]): Source[Seq[T], NotUsed]

    Combine the elements of multiple streams into a stream of sequences.

  56. def zipWithN[T, O](zipper: (Seq[T]) => O)(sources: Seq[Source[T, _]]): Source[O, NotUsed]

Deprecated Value Members

  1. def actorRef[T](bufferSize: Int, overflowStrategy: OverflowStrategy): Source[T, ActorRef]

    Creates a Source that is materialized as an akka.actor.ActorRef.

    Creates a Source that is materialized as an akka.actor.ActorRef. Messages sent to this actor will be emitted to the stream if there is demand from downstream, otherwise they will be buffered until request for demand is received.

    Depending on the defined akka.stream.OverflowStrategy it might drop elements if there is no space available in the buffer.

    The strategy akka.stream.OverflowStrategy.backpressure is not supported, and an IllegalArgument("Backpressure overflowStrategy not supported") will be thrown if it is passed as argument.

    The buffer can be disabled by using bufferSize of 0 and then received messages are dropped if there is no demand from downstream. When bufferSize is 0 the overflowStrategy does not matter.

    The stream can be completed successfully by sending the actor reference a akka.actor.Status.Success. If the content is akka.stream.CompletionStrategy.immediately the completion will be signaled immediately. Otherwise, if the content is akka.stream.CompletionStrategy.draining (or anything else) already buffered elements will be sent out before signaling completion. Using akka.actor.PoisonPill or akka.actor.ActorSystem.stop to stop the actor and complete the stream is *not supported*.

    The stream can be completed with failure by sending a akka.actor.Status.Failure to the actor reference. In case the Actor is still draining its internal buffer (after having received a akka.actor.Status.Success) before signaling completion and it receives a akka.actor.Status.Failure, the failure will be signaled downstream immediately (instead of the completion signal).

    The actor will be stopped when the stream is canceled from downstream, i.e. you can watch it to get notified when that happens.

    See also akka.stream.scaladsl.Source.queue.

    bufferSize

    The size of the buffer in element count

    overflowStrategy

    Strategy that is used when incoming elements cannot fit inside the buffer

    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Use variant accepting completion and failure matchers instead

  2. def actorRefWithAck[T](ackMessage: Any): Source[T, ActorRef]

    Creates a Source that is materialized as an akka.actor.ActorRef.

    Creates a Source that is materialized as an akka.actor.ActorRef. Messages sent to this actor will be emitted to the stream if there is demand from downstream, and a new message will only be accepted after the previous messages has been consumed and acknowledged back. The stream will complete with failure if a message is sent before the acknowledgement has been replied back.

    The stream can be completed successfully by sending the actor reference a akka.actor.Status.Success. If the content is akka.stream.CompletionStrategy.immediately the completion will be signaled immediately, otherwise if the content is akka.stream.CompletionStrategy.draining (or anything else) already buffered element will be signaled before signaling completion.

    The stream can be completed with failure by sending a akka.actor.Status.Failure to the actor reference. In case the Actor is still draining its internal buffer (after having received a akka.actor.Status.Success) before signaling completion and it receives a akka.actor.Status.Failure, the failure will be signaled downstream immediately (instead of the completion signal).

    The actor will be stopped when the stream is completed, failed or canceled from downstream, i.e. you can watch it to get notified when that happens.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Use actorRefWithBackpressure accepting completion and failure matchers instead

  3. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

  4. def fromCompletionStage[T](future: CompletionStage[T]): Source[T, NotUsed]

    Starts a new Source from the given Future.

    Starts a new Source from the given Future. The stream will consist of one element when the Future is completed with a successful value, which may happen before or after materializing the Flow. The stream terminates with a failure if the Future is completed with a failure.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Use 'Source.completionStage' instead

  5. def fromFuture[T](future: Future[T]): Source[T, NotUsed]

    Starts a new Source from the given Future.

    Starts a new Source from the given Future. The stream will consist of one element when the Future is completed with a successful value, which may happen before or after materializing the Flow. The stream terminates with a failure if the Future is completed with a failure.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Use 'Source.future' instead

  6. def fromFutureSource[T, M](future: Future[Graph[SourceShape[T], M]]): Source[T, Future[M]]

    Streams the elements of the given future source once it successfully completes.

    Streams the elements of the given future source once it successfully completes. If the Future fails the stream is failed with the exception from the future. If downstream cancels before the stream completes the materialized Future will be failed with a StreamDetachedException

    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Use 'Source.futureSource' (potentially together with Source.fromGraph) instead

  7. def fromSourceCompletionStage[T, M](completion: CompletionStage[_ <: Graph[SourceShape[T], M]]): Source[T, CompletionStage[M]]

    Streams the elements of an asynchronous source once its given completion operator completes.

    Streams the elements of an asynchronous source once its given completion operator completes. If the CompletionStage fails the stream is failed with the exception from the future. If downstream cancels before the stream completes the materialized Future will be failed with a StreamDetachedException

    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Use scala-compat CompletionStage to future converter and 'Source.futureSource' instead

  8. def lazily[T, M](create: () => Source[T, M]): Source[T, Future[M]]

    Creates a Source that is not materialized until there is downstream demand, when the source gets materialized the materialized future is completed with its value, if downstream cancels or fails without any demand the create factory is never called and the materialized Future is failed.

    Creates a Source that is not materialized until there is downstream demand, when the source gets materialized the materialized future is completed with its value, if downstream cancels or fails without any demand the create factory is never called and the materialized Future is failed.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Use 'Source.lazySource' instead

  9. def lazilyAsync[T](create: () => Future[T]): Source[T, Future[NotUsed]]

    Creates a Source from supplied future factory that is not called until downstream demand.

    Creates a Source from supplied future factory that is not called until downstream demand. When source gets materialized the materialized future is completed with the value from the factory. If downstream cancels or fails without any demand the create factory is never called and the materialized Future is failed.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Use 'Source.lazyFuture' instead

    See also

    Source.lazily

  10. def setup[T, M](factory: (ActorMaterializer, Attributes) => Source[T, M]): Source[T, Future[M]]

    Defers the creation of a Source until materialization.

    Defers the creation of a Source until materialization. The factory function exposes ActorMaterializer which is going to be used during materialization and Attributes of the Source returned by this method.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.0) Use 'fromMaterializer' instead

Inherited from AnyRef

Inherited from Any

Ungrouped