Created
December 18, 2017 19:54
-
-
Save Romeh/841ebc0a972f1b771f97d12fdf43ea4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* sample service for how to call map reduce jobs in parallel asynchronous with fail fast reducer | |
*/ | |
@Service | |
public class ComputeService { | |
private static final Logger logger = LoggerFactory.getLogger(AlertsService.class); | |
private final DataGridCompute dataGridCompute; | |
@Autowired | |
private FailFastReducer failFastReducer; | |
@Autowired | |
public ComputeService(DataGridCompute dataGridCompute) { | |
this.dataGridCompute = dataGridCompute; | |
} | |
/** | |
* call to ignite compute grid with list if jobs in parallel asynchronous | |
*/ | |
public void validateWithAllServicesInParallelAsync(List<IgniteCallable<ServiceResponse>> jobs){ | |
// execute the jobs with the fail fast reducer in parallel and async the just log the final aggregated response | |
dataGridCompute.executeMapReduceFailFast(jobs,failFastReducer, | |
mapReduceResponse -> logger.debug(mapReduceResponse.toString())); | |
} | |
/** | |
* call to ignite compute grid with list if jobs in parallel synchronous | |
*/ | |
public MapReduceResponse validateWithAllServicesInParallelSync(List<IgniteCallable<ServiceResponse>> jobs){ | |
// execute the jobs with the fail fast reducer in parallel and sync the just log the final aggregated response | |
return dataGridCompute.executeMapReduceFailFastSync(jobs,failFastReducer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment