Object

fs2.concurrent

Broadcast

Related Doc: package concurrent

Permalink

object Broadcast

Provides mechanisms for broadcast distribution of elements to multiple streams.

Source
Broadcast.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Broadcast
  2. AnyRef
  3. 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[F[_], O](minReady: Int)(implicit arg0: Concurrent[F]): Pipe[F, O, Stream[F, O]]

    Permalink

    Allows elements of a stream to be broadcast to multiple workers.

    Allows elements of a stream to be broadcast to multiple workers.

    As the elements arrive, they are broadcast to all workers that have started evaluation before the element was pulled.

    Elements are pulled as chunks from the source and the next chunk is pulled when all workers are done with processing the current chunk. This behaviour may slow down processing of incoming chunks by faster workers. If this is not desired, consider using the prefetch and prefetchN combinators on workers to compensate for slower workers.

    Often this combinator is used together with parJoin, such as :

    Stream(1,2,3,4).broadcast.map { worker =>
      worker.evalMap { o => IO.println("1:" + o.toString) }
    }.take(3).parJoinUnbounded.compile.drain.unsafeRunSync

    Note that in the example, above the workers are not guaranteed to see all elements emitted. This is due to different subscription times of each worker and speed of emitting the elements by the source. If this is not desired, consider using broacastThrough and broadcastTo, which are built on top of Broadcast.through, as an alternative. They will hold on pulling from source if there are no workers ready.

    When source terminates, then the inner streams (workers) are terminated once all elements pulled from source are processed by all workers. However, note that when that source terminates, resulting stream will not terminate until the inner streams terminate.

    minReady

    specifies that broadcasting will hold off until at least minReady subscribers will be ready

  5. final def asInstanceOf[T0]: T0

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  11. final def isInstanceOf[T0]: Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  14. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  16. def through[F[_], O, O2](pipes: Pipe[F, O, O2]*)(implicit arg0: Concurrent[F]): Pipe[F, O, O2]

    Permalink

    Like apply but instead of providing a stream of worker streams, it runs each inner stream through the supplied pipes.

    Like apply but instead of providing a stream of worker streams, it runs each inner stream through the supplied pipes.

    Supplied pipes are run concurrently with each other. Hence, the number of pipes determines concurrency. Also, this guarantees that each sink will view all O pulled from source stream, unlike broadcast.

    Resulting values are collected and returned in a single stream of O2 values.

    pipes

    pipes that will concurrently process the work

  17. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def wait(arg0: Long, arg1: Int): Unit

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(): Unit

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

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped