abstract class Topic[F[_], A] extends AnyRef
Asynchronous Topic.
Topic allows you to distribute A
published by arbitrary number of publishers to arbitrary number of subscribers.
Topic has built-in back-pressure support implemented as maximum bound (maxQueued
) that a subscriber is allowed to enqueue.
Once that bound is hit, publishing may semantically block until the lagging subscriber consumes some of its queued elements.
Additionally the subscriber has possibility to terminate whenever size of enqueued elements is over certain size
by using subscribeSize
.
- Self Type
- Topic[F, A]
- Source
- Topic.scala
- Alphabetic
- By Inheritance
- Topic
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Topic()
Abstract Value Members
- abstract def publish: Pipe[F, A, Unit]
Publishes elements from source of
A
to this topic and emits a unit for each element published.Publishes elements from source of
A
to this topic and emits a unit for each element published. Pipe equivalent ofpublish1
. - abstract def publish1(a: A): F[Unit]
Publishes one
A
to topic.Publishes one
A
to topic.This waits until
a
is published to all subscribers. If any of the subscribers is over themaxQueued
limit, this will wait to complete until that subscriber processes enough of its elements such thata
is enqueued. - 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.The first element in the stream is always the last published
A
at the time the stream is first pulled from, followed by each publishedA
value from that point forward.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
- abstract def subscribeSize(maxQueued: Int): Stream[F, (A, Int)]
Like subscribe but emits an approximate number of queued elements for this subscription with each emitted
A
value. - abstract def subscribers: Stream[F, Int]
Signal of current active subscribers.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def imap[B](f: (A) => B)(g: (B) => A): Topic[F, B]
Returns an alternate view of this
Topic
where its elements are of typeB
, given two functions,A => B
andB => A
. - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated