linkedin/parseq

Is it possible to synchronize tasks?

yaseco opened this issue · 2 comments

Suppose we have a List<City> cities and we also have getStreets(City city) which returns List<Street>. Let's assume that every Street needs to be processed with some IO request.

I would like to have a reasonable control over the processing. For example, emit the next city only when all the streets of the current city were processed.

Is it possible? How would you do that?

Task.callable() achieves that, all the execution is done sequentially

The question is not so clear.

If I am understanding correctly, here is what supposed to be done

Let's say you create one single Task for getStreets(City city) with single city.

Then basically what is being asked is to sequentially process all the cities, which can be achieved by Tasks.seq() interface.