Exchange

interface Exchange<I, O> : SendExchange<I, O> , ReceiveExchange<I, O>

An interface defining an Exchange, which is able to generate some flows that are used for bidirectional communication and transmission of data.

Parameters

I

the type of the domain-specific incoming events for this Exchange.

O

the type of the domain-specific outgoing events for this Exchange.

Functions

Link copied to clipboard
abstract fun receive(incoming: Flow<O>): Flow<I>

Sends some I as a response to an incoming of O.

Link copied to clipboard
abstract fun send(incoming: Flow<I>): Flow<O>

Sends some O as a response to an incoming of I.

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun <I, O> Exchange<I, O>.buffer(capacity: Int = Channel.BUFFERED): Exchange<I, O>

Transforms an Exchange by buffering its contents. This buffers the underlying flows in both directions.

Link copied to clipboard
fun <I, O> Exchange<I, O>.flowOn(context: CoroutineContext): Exchange<I, O>

Transforms an Exchange by making it flow on a specific dispatcher. The same CoroutineContext will be used in both directions for the communicating Flows.