Hi guys, I was thinking of implementing some <scat...
# coroutines
Hi guys, I was thinking of implementing some scatter-gather pattern for an app in Kotlin. I know Spring provides native support to it but to be hones it seems too much complex for being as simple as the scatter-gather pattern. I was thinking to use channels or maybe better flows to do so, any suggestions? Maybe there is some library ready out there?
One idea I was thinking about would have been to emit an event (for the scatter part) where there are multiple subscribers. In the event I can pass by a Flow. then each listener will write in the flow the data it needs to. On the other side, the aggregator will use the flow sent in the event and consume it until all the listeners finished writing into that. What do you think about the approach? The only thing in my mind is that flows are sequential, which is good from the aggregator standpoint. But the scatter part should invoke the event listeners in parallel if I want them to fetch data concurrently. Do you see any problem in my reasoning?