Custom gatherers - handling an update stop
Managed by | Updated .
The configuration object contains a method that checks if a user has requested a stop to an update.
Your custom gatherer should check this and gracefully exit.
The best place to put this code is inside the main processing loop - it should be configured to check every N iterations of the loop - this could be combined with a call to update the collection status (visible in the administration interface).
eg. Check every 100 iterations and exit if a stop is requested, otherwise just print out a status update indicating how many records have been processed.
custom_gather.groovy
if ((i % 100) == 0)
{
// check to see if the update has been stopped by a user
if (config.isUpdateStopped()) {
store.close()
throw new RuntimeException("Update stop requested by user.");
}
// Print status message
config.setProgressMessage("Processed "+i+" records");
}
Was this artcle helpful?