ChannelMultiplexer

gears.async.ChannelMultiplexer
See theChannelMultiplexer companion object
trait ChannelMultiplexer[T] extends Closeable

Channel multiplexer is an object where one can register publisher and subscriber channels. When it is run, it continuously races the set of publishers and once it reads a value, it sends a copy to each subscriber.

When a publisher or subscriber channel is closed, it will be removed from the multiplexer's set.

For an unchanging set of publishers and subscribers and assuming that the multiplexer is the only reader of the publisher channels, every subscriber will receive the same set of messages, in the same order and it will be exactly all messages sent by the publishers. The only guarantee on the order of the values the subscribers see is that values from the same publisher will arrive in order.

Channel multiplexer can also be closed, in that case all subscribers will receive Failure(ChannelClosedException) but no attempt at closing either publishers or subscribers will be made.

Attributes

Companion
object
Graph
Supertypes
trait Closeable
trait AutoCloseable
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def addPublisher(c: ReadableChannel[T]): Unit
def addSubscriber(c: SendableChannel[Try[T]]): Unit
def removePublisher(c: ReadableChannel[T]): Unit
def removeSubscriber(c: SendableChannel[Try[T]]): Unit
def run()(using Async): Unit

Run the multiplexer. Returns after this multiplexer has been cancelled.

Run the multiplexer. Returns after this multiplexer has been cancelled.

Attributes

Inherited and Abstract methods

def close(): Unit

Attributes

Inherited from:
Closeable