NIFI-3349 retry stale connections

This closes #2149.

Signed-off-by: Bryan Bende <bbende@apache.org>
This commit is contained in:
Noe 2017-09-12 14:19:11 -04:00 committed by Bryan Bende
parent 8741b6f6a5
commit 0a47a3bde5
No known key found for this signature in database
GPG Key ID: A0DDA9ED50711C39
1 changed files with 12 additions and 1 deletions

View File

@ -458,7 +458,18 @@ public class GetSplunk extends AbstractProcessor {
getLogger().debug("Using index_earliest of {} and index_latest of {}", new Object[]{earliestTime, latestTime});
}
final InputStream exportSearch = splunkService.export(query, exportArgs);
InputStream export;
try{
export = splunkService.export(query, exportArgs);
//Catch Stale connection exception, reinitialize, and retry
} catch (com.splunk.HttpException e) {
getLogger().error("Splunk request status code:" + e.getStatus() + " Retrying the request.");
splunkService.logout();
splunkService = createSplunkService(context);
export = splunkService.export(query, exportArgs);
}
final InputStream exportSearch = export;
FlowFile flowFile = session.create();
flowFile = session.write(flowFile, new OutputStreamCallback() {