in src/main/java/com/amazonaws/transcribestreaming/TranscribeStreamingRetryClient.java [206:231]
private StartStreamTranscriptionResponseHandler getResponseHandler(
StreamTranscriptionBehavior transcriptionBehavior) {
final StartStreamTranscriptionResponseHandler build = StartStreamTranscriptionResponseHandler.builder()
.onResponse(r -> {
transcriptionBehavior.onResponse(r);
})
.onError(e -> {
//Do nothing here. Don't close any streams that shouldn't be cleaned up yet.
logger.info("Reached on error but doing nothing" + e);
})
.onComplete(() -> {
//Do nothing here. Don't close any streams that shouldn't be cleaned up yet.
logger.info("Reached on complete.");
})
.subscriber(event -> {
try {
transcriptionBehavior.onStream(event);
}
// We swallow any exception occurred while processing the TranscriptEvent and continue transcribing
// Transcribe errors will however cause the future to complete exceptionally and we'll retry (if applicable)
catch (Exception e) {
}
})
.build();
return build;
}