akka.stream

scaladsl

package scaladsl

Scala API: The flow DSL allows the formulation of stream transformations based on some input. The starting point is called Source and can be a collection, an iterator, a block of code which is evaluated repeatedly or a org.reactivestreams.Publisher. A flow with an attached input and open output is also a Source.

A flow may also be defined without an attached input or output and that is then a Flow. The Flow can be connected to the Source later by using Source#via with the flow as argument, and it remains a Source.

Transformations can be appended to Source and Flow with the operations defined in FlowOps. Each DSL element produces a new flow that can be further transformed, building up a description of the complete transformation pipeline.

The termination point of a flow is called Sink and can for example be a Future or org.reactivestreams.Subscriber. A flow with an attached output and open input is also a Sink.

If a flow has both an attached input and an attached output it becomes a RunnableGraph. In order to execute this pipeline the flow must be materialized by calling RunnableGraph#run on it.

You can create your Source, Flow and Sink in any order and then wire them together before they are materialized by connecting them using Flow#via and Flow#to, or connecting them into a FlowGraph with fan-in and fan-out elements.

See Reactive Streams for details on org.reactivestreams.Publisher and org.reactivestreams.Subscriber.

It should be noted that the streams modeled by this library are “hot”, meaning that they asynchronously flow through a series of processors without detailed control by the user. In particular it is not predictable how many elements a given transformation step might buffer before handing elements downstream, which means that transformation functions may be invoked more often than for corresponding transformations on strict collections like List. *An important consequence* is that elements that were produced into a stream may be discarded by later processors, e.g. when using the #take combinator.

By default every operation is executed within its own akka.actor.Actor to enable full pipelining of the chained set of computations. This behavior is determined by the akka.stream.Materializer which is required by those methods that materialize the Flow into a series of org.reactivestreams.Processor instances. The returned reactive stream is fully started and active.

Use ImplicitMaterializer to define an implicit akka.stream.Materializer inside an akka.actor.Actor.

Source
package.scala
Linear Supertypes
Content Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. scaladsl
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. class Balance[T] extends Graph[UniformFanOutShape[T, T], Unit]

    Fan-out the stream to several streams.

  2. final class BidiFlow[-I1, +O1, -I2, +O2, +Mat] extends Graph[BidiShape[I1, O1, I2, O2], Mat]

  3. trait BidiFlowApply extends AnyRef

  4. class Broadcast[T] extends Graph[UniformFanOutShape[T, T], Unit]

    Fan-out the stream to several streams emitting each incoming upstream element to all downstream consumers.

  5. class Concat[T] extends Graph[UniformFanInShape[T, T], Unit]

    Takes two streams and outputs one stream formed from the two input streams by first emitting all of the elements from the first stream and then emitting all of the elements from the second stream.

  6. abstract class FlattenStrategy[-S, +T] extends AnyRef

    Strategy that defines how a stream of streams should be flattened into a stream of simple elements.

  7. abstract class FlexiMerge[Out, S <: Shape] extends Graph[S, Unit]

    Base class for implementing custom merge junctions.

  8. abstract class FlexiRoute[In, S <: Shape] extends Graph[S, Unit]

    Base class for implementing custom route junctions.

  9. final class Flow[-In, +Out, +Mat] extends FlowOps[Out, Mat] with Graph[FlowShape[In, Out], Mat]

    A Flow is a set of stream processing steps that has one open input and one open output.

  10. trait FlowApply extends AnyRef

  11. trait FlowOps[+Out, +Mat] extends AnyRef

    Scala API: Operations offered by Sources and Flows with a free output side: the DSL flows left-to-right only.

  12. trait GraphApply extends AnyRef

  13. trait ImplicitMaterializer extends AnyRef

    Mix this trait into your akka.actor.Actor if you need an implicit akka.stream.Materializer in scope.

  14. class Merge[T] extends Graph[UniformFanInShape[T, T], Unit]

    Merge several streams, taking elements as they arrive from input streams (picking randomly when several have elements ready).

  15. class MergePreferred[T] extends Graph[MergePreferredShape[T], Unit]

    Merge several streams, taking elements as they arrive from input streams (picking from preferred when several have elements ready).

  16. case class RunnableGraph[+Mat](module: Module) extends Graph[ClosedShape, Mat] with Product with Serializable

    Flow with attached input and output, can be executed.

  17. final class Sink[-In, +Mat] extends Graph[SinkShape[In], Mat]

    A Sink is a set of stream processing steps that has one open input and an attached output.

  18. trait SinkApply extends AnyRef

  19. final class Source[+Out, +Mat] extends FlowOps[Out, Mat] with Graph[SourceShape[Out], Mat]

    A Source is a set of stream processing steps that has one open output.

  20. trait SourceApply extends AnyRef

  21. class Tcp extends Extension

  22. class Unzip[A, B] extends Graph[FanOutShape2[(A, B), A, B], Unit]

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

  23. class UnzipWith10[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10] extends Graph[FanOutShape10[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10], Unit]

    UnzipWith specialized for 10 outputs

  24. class UnzipWith11[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11] extends Graph[FanOutShape11[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11], Unit]

    UnzipWith specialized for 11 outputs

  25. class UnzipWith12[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12] extends Graph[FanOutShape12[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12], Unit]

    UnzipWith specialized for 12 outputs

  26. class UnzipWith13[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13] extends Graph[FanOutShape13[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13], Unit]

    UnzipWith specialized for 13 outputs

  27. class UnzipWith14[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14] extends Graph[FanOutShape14[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14], Unit]

    UnzipWith specialized for 14 outputs

  28. class UnzipWith15[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15] extends Graph[FanOutShape15[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15], Unit]

    UnzipWith specialized for 15 outputs

  29. class UnzipWith16[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16] extends Graph[FanOutShape16[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16], Unit]

    UnzipWith specialized for 16 outputs

  30. class UnzipWith17[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17] extends Graph[FanOutShape17[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17], Unit]

    UnzipWith specialized for 17 outputs

  31. class UnzipWith18[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18] extends Graph[FanOutShape18[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18], Unit]

    UnzipWith specialized for 18 outputs

  32. class UnzipWith19[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19] extends Graph[FanOutShape19[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19], Unit]

    UnzipWith specialized for 19 outputs

  33. class UnzipWith2[In, A1, A2] extends Graph[FanOutShape2[In, A1, A2], Unit]

    UnzipWith specialized for 2 outputs

  34. class UnzipWith20[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20] extends Graph[FanOutShape20[In, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20], Unit]

    UnzipWith specialized for 20 outputs

  35. class UnzipWith3[In, A1, A2, A3] extends Graph[FanOutShape3[In, A1, A2, A3], Unit]

    UnzipWith specialized for 3 outputs

  36. class UnzipWith4[In, A1, A2, A3, A4] extends Graph[FanOutShape4[In, A1, A2, A3, A4], Unit]

    UnzipWith specialized for 4 outputs

  37. class UnzipWith5[In, A1, A2, A3, A4, A5] extends Graph[FanOutShape5[In, A1, A2, A3, A4, A5], Unit]

    UnzipWith specialized for 5 outputs

  38. class UnzipWith6[In, A1, A2, A3, A4, A5, A6] extends Graph[FanOutShape6[In, A1, A2, A3, A4, A5, A6], Unit]

    UnzipWith specialized for 6 outputs

  39. class UnzipWith7[In, A1, A2, A3, A4, A5, A6, A7] extends Graph[FanOutShape7[In, A1, A2, A3, A4, A5, A6, A7], Unit]

    UnzipWith specialized for 7 outputs

  40. class UnzipWith8[In, A1, A2, A3, A4, A5, A6, A7, A8] extends Graph[FanOutShape8[In, A1, A2, A3, A4, A5, A6, A7, A8], Unit]

    UnzipWith specialized for 8 outputs

  41. class UnzipWith9[In, A1, A2, A3, A4, A5, A6, A7, A8, A9] extends Graph[FanOutShape9[In, A1, A2, A3, A4, A5, A6, A7, A8, A9], Unit]

    UnzipWith specialized for 9 outputs

  42. trait UnzipWithApply extends AnyRef

  43. class Zip[A, B] extends Graph[FanInShape2[A, B, (A, B)], Unit]

    Combine the elements of 2 streams into a stream of tuples.

  44. class ZipWith10[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, O] extends Graph[FanInShape10[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, O], Unit]

    ZipWith specialized for 10 inputs

  45. class ZipWith11[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, O] extends Graph[FanInShape11[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, O], Unit]

    ZipWith specialized for 11 inputs

  46. class ZipWith12[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, O] extends Graph[FanInShape12[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, O], Unit]

    ZipWith specialized for 12 inputs

  47. class ZipWith13[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, O] extends Graph[FanInShape13[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, O], Unit]

    ZipWith specialized for 13 inputs

  48. class ZipWith14[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, O] extends Graph[FanInShape14[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, O], Unit]

    ZipWith specialized for 14 inputs

  49. class ZipWith15[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, O] extends Graph[FanInShape15[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, O], Unit]

    ZipWith specialized for 15 inputs

  50. class ZipWith16[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, O] extends Graph[FanInShape16[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, O], Unit]

    ZipWith specialized for 16 inputs

  51. class ZipWith17[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, O] extends Graph[FanInShape17[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, O], Unit]

    ZipWith specialized for 17 inputs

  52. class ZipWith18[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, O] extends Graph[FanInShape18[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, O], Unit]

    ZipWith specialized for 18 inputs

  53. class ZipWith19[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, O] extends Graph[FanInShape19[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, O], Unit]

    ZipWith specialized for 19 inputs

  54. class ZipWith2[A1, A2, O] extends Graph[FanInShape2[A1, A2, O], Unit]

    ZipWith specialized for 2 inputs

  55. class ZipWith20[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, O] extends Graph[FanInShape20[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, O], Unit]

    ZipWith specialized for 20 inputs

  56. class ZipWith3[A1, A2, A3, O] extends Graph[FanInShape3[A1, A2, A3, O], Unit]

    ZipWith specialized for 3 inputs

  57. class ZipWith4[A1, A2, A3, A4, O] extends Graph[FanInShape4[A1, A2, A3, A4, O], Unit]

    ZipWith specialized for 4 inputs

  58. class ZipWith5[A1, A2, A3, A4, A5, O] extends Graph[FanInShape5[A1, A2, A3, A4, A5, O], Unit]

    ZipWith specialized for 5 inputs

  59. class ZipWith6[A1, A2, A3, A4, A5, A6, O] extends Graph[FanInShape6[A1, A2, A3, A4, A5, A6, O], Unit]

    ZipWith specialized for 6 inputs

  60. class ZipWith7[A1, A2, A3, A4, A5, A6, A7, O] extends Graph[FanInShape7[A1, A2, A3, A4, A5, A6, A7, O], Unit]

    ZipWith specialized for 7 inputs

  61. class ZipWith8[A1, A2, A3, A4, A5, A6, A7, A8, O] extends Graph[FanInShape8[A1, A2, A3, A4, A5, A6, A7, A8, O], Unit]

    ZipWith specialized for 8 inputs

  62. class ZipWith9[A1, A2, A3, A4, A5, A6, A7, A8, A9, O] extends Graph[FanInShape9[A1, A2, A3, A4, A5, A6, A7, A8, A9, O], Unit]

    ZipWith specialized for 9 inputs

  63. trait ZipWithApply extends AnyRef

Value Members

  1. object Balance

  2. object BidiFlow extends BidiFlowApply

  3. object Broadcast

  4. object Concat

  5. object FlattenStrategy

  6. object FlexiMerge

  7. object FlexiRoute

  8. object Flow extends FlowApply

  9. object FlowGraph extends GraphApply

  10. object Keep

    Convenience functions for often-encountered purposes like keeping only the left (first) or only the right (second) of two input values.

  11. object Merge

  12. object MergePreferred

  13. object Sink extends SinkApply

  14. object Source extends SourceApply

  15. object Tcp extends ExtensionId[Tcp] with ExtensionIdProvider

  16. object Unzip

    Takes a stream of pair elements and splits each pair to two output streams.

  17. object UnzipWith extends UnzipWithApply

    Transforms each element of input stream into multiple streams using a splitter function.

  18. object UnzipWithApply

  19. object Zip

  20. object ZipWith extends ZipWithApply

    Combine the elements of multiple streams into a stream of combined elements using a combiner function.

Inherited from AnyRef

Inherited from Any

Ungrouped