arrow-fx-coroutines / arrow.fx.coroutines.stream.concurrent / Topic / subscribe

subscribe

fun subscribe(maxQueued: Int): Stream<A>

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 published A 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.

Parameters

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

Do you like Arrow?

Arrow Org
<