Packages

abstract class Topic[F[_], A] extends AnyRef

Topic allows you to distribute As published by an arbitrary number of publishers to an arbitrary number of subscribers.

Topic has built-in back-pressure support implemented as the maximum number of elements (maxQueued) that a subscriber is allowed to enqueue.

Once that bound is hit, any publishing action will semantically block until the lagging subscriber consumes some of its queued elements.

Self Type
Topic[F, A]
Source
Topic.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Topic
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Topic()

Abstract Value Members

  1. abstract def publish: Pipe[F, A, Nothing]

    Publishes elements from source of A to this topic.

    Publishes elements from source of A to this topic. Pipe equivalent of publish1.

  2. abstract def publish1(a: A): F[Unit]

    Publishes one A to topic.

    Publishes one A to topic.

    This operation does not complete until after the given element has been enqued on all subscribers, which means that if any subscriber is at its maxQueued limit, publish1 will semantically block until that subscriber consumes an element.

    A semantically blocked publication can be interrupted, but there is no guarantee of atomicity, and it could result in the A being received by some subscribers only.

    Note: if publish1 is called concurrently by multiple producers, different subscribers may receive messages from different producers in a different order.

  3. abstract def subscribe(maxQueued: Int): Stream[F, A]

    Subscribes for A values that are published to this topic.

    Subscribes for A values that are published to this topic.

    Pulling on the returned stream opens a "subscription", which allows up to maxQueued elements to be enqueued as a result of publication.

    If at any point, the queue backing the subscription has maxQueued elements in it, any further publications semantically block until elements are dequeued from the subscription queue.

    maxQueued

    maximum number of elements to enqueue to the subscription queue before blocking publishers

  4. abstract def subscribeAwait(maxQueued: Int): Resource[F, Stream[F, A]]

    Like subscribe, but represents the subscription explicitly as a Resource which returns after the subscriber is subscribed, but before it has started pulling elements.

  5. abstract def subscribers: Stream[F, Int]

    Signal of current active subscribers.

Concrete 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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. def imap[B](f: (A) => B)(g: (B) => A): Topic[F, B]

    Returns an alternate view of this Topic where its elements are of type B, given two functions, A => B and B => A.

  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  18. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

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

Inherited from AnyRef

Inherited from Any

Ungrouped