Object/Class

datto.flow

FlowBuilder

Related Docs: class FlowBuilder | package flow

Permalink

object FlowBuilder extends Serializable

A FlowBuilder provides tools for cunstructing an akka.stream Flow that transforms a FlowResult into another FlowResult. More explicitly, it is used to construct a Flow[FlowResult[I, Ctx], FlowResult[T, Ctx], akka.NotUsed]. Here I is thought of as the initial or input type, T is the terminal or output type, and Ctx is the context type which remains unchanged throughout the flow.

We prefer to transform FlowResults rather than the raw types I and T because it allows us to carry along all the extra information contained in the FlowResult. Namely, the context, the success/failure status, and the metadata. FlowBuilder makes it easy to transform the underlying types without affecting this context, and will transparently propogate failures.

Example:
  1. val flow: Flow[FlowResult[Int, Int], FlowResult[String, Int], akka.NotUsed] = FlowBuilder.simple[Int] .map(i => i * 2) .flatMap { case i if i < 0 => Failure(new Exception("number is negative!")) case i => Success(i) }.mapWithContext((i, context, metadata) => s"Value: $i, Context: $context") .flow This starts with an initial Flow containing FlowResults of integers (and with context as the initia int value). It then:

    • multiplies the initial value by 2.
    • if the value is less than 0, converts it to a failure. This means that subsequent steps in the flow will not be performed.
    • Uses both the context and the value to produce a new String value.
    • retrieves the underlying akka.stream Flow.
Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FlowBuilder
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def apply[I, T, Ctx](flow: Flow[FlowResult[I, Ctx], FlowResult[T, Ctx], NotUsed]): FlowBuilder[I, T, Ctx]

    Permalink
  5. def apply[I, Ctx](parallelism: Int): FlowBuilder[I, I, Ctx]

    Permalink
  6. def apply[I, Ctx](): FlowBuilder[I, I, Ctx]

    Permalink

    Return an empty (identity transformation) FlowBuilder based on the initial and context types.

  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. def simple[I](parallelism: Int): FlowBuilder[I, I, I]

    Permalink

    Return an empty (identity transformation) FlowBuilder in which the initial type and the context type are the same.

  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped