February 2018
Intermediate to advanced
350 pages
7h 35m
English
When we have channels, we can have related patterns, such as pipelines. A pipeline is a series of channels connecting consumers and producers, similar to Unix pipes or Enterprise Integration Patterns (EIP).
Let's write our own sales system using EIPs. Let's first take a look at the models:
data class Quote(val value: Double, val client: String, val item: String, val quantity: Int)data class Bill(val value: Double, val client: String)data class PickingOrder(val item: String, val quantity: Int)
Now, let's take a look at the patterns:
import kotlinx.coroutines.experimental.CoroutineContextfun calculatePriceTransformer(coroutineContext: CoroutineContext, quoteChannel: ReceiveChannel<Quote>) = produce(coroutineContext) { for ...
Read now
Unlock full access