Flows 

Now that we have the source and the sink, let's implement the flow itself. Again, we will start with the simplest parts and switch to the more complex as we progress.

The easiest flow building block is surely the Cook. It could be implemented as a map function called on the preceding flow definition but for composing reasons, we'd like to define it separately.

The approach of the flow definition is consistent with the previous two—the Flow constructor is the way to go. The flow is defined in terms of operations on the input but the definition itself is decoupled from this input. Again there are lots of methods to choose from; for our purposes, we pick the simple map

object Cook {  def formFlow: Flow[Dough, RawCookies, NotUsed] =

Get Learn Scala Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.