Order guarantees using streams and reducing chain of consumers
问题 So as it goes in the current scenario, we have a set of APIs as listed below: Consumer<T> start(); Consumer<T> performDailyAggregates(); Consumer<T> performLastNDaysAggregates(); Consumer<T> repopulateScores(); Consumer<T> updateDataStore(); Over these, one of our schedulers performs the tasks e.g. private void performAllTasks(T data) { start().andThen(performDailyAggregates()) .andThen(performLastNDaysAggregates()) .andThen(repopulateScores()) .andThen(updateDataStore()) .accept(data); }