It’s basically the same thing. What many people do is call execute activity in the loop collecting futures, and then another loop to get results. This allows activities to run in parallel. Of course workflow.Go does too.
I am trying to decide whether to use workflow goroutines or simply collect Futures. My use case requires that we do not block at any point, i.e. we don’t wait for goroutines to finish or futures to be ready. We also want to run some code (update a map) at the end of the goroutine, or when the future is ready with AddFuture.
It seems to be that AddFuture is called only when Select runs? I haven’t tested this, but in the documentation it says “The callback is called when Select(ctx) is called.”
That means that running code on completion using Futures, requires to run Select at some point, and therefore block. The workaround would be to run Select in a separate goroutine to avoid blocking, but if we are gonna do that, we might as well use workflow goroutines instead of futures in the first place.
Would be nice to have a comparison between goroutines and futures-based design somewhere. Looks like they can both be used for parallelism, but each one has its own pros/cons.