Slide 56
Slide 56 text
def graph(source : Source[PropertyChange, NotUsed],
process : Flow[PropertyChange, Either[ValidationError, AdwordsChange], NotUsed],
store : Flow[AdwordsChange, Either[StorageError, Stored], NotUsed],
errorSink: Sink[AdwordsStreamError, NotUsed]): RunnableGraph[Future[Done]] = {
val processAndDivert: Flow[PropertyChange, AdwordsChange, NotUsed] =
process via DivertErrors(to = errorSink)
val storeAndDivert: Flow[AdwordsChange, Stored, NotUsed] =
store via DivertErrors(to = errorSink)
source
.via(processAndDivert)
.via(storeAndDivert)
.toMat(Sink.ignore)(Keep.right)
}
GRAPH