How it works...
In this recipe, we demonstrated how to use the GraphDSL. To begin with, we defined our sources. To simulate our notifications coming from Android and iOS, we created two classes: AndroidMsg and IosMsg. We can emit elements periodically using Source.tick, as we did. Secondly, we defined our Flows to map, group, and count our elements.
Afterward, we instantiated our junctions: Merge, Broadcast, and Balance. It is worth mentioning that to be able to use junctions properly in the graph, we need to add them through builder. The builder is a helper to provide another graph. It returns the appropriate shape with the ports that you will need to connect. When creating any of the junctions, we need to provide the number of ports. For instance, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access