use of com.amazonaws.services.qldb.model.DescribeJournalKinesisStreamRequest in project amazon-qldb-dmv-sample-java by aws-samples.
the class StreamJournal method waitForQldbStreamCompletion.
/**
* Wait for Kinesis Data Stream completion.
*/
public static void waitForQldbStreamCompletion() {
DescribeJournalKinesisStreamRequest describeStreamRequest = new DescribeJournalKinesisStreamRequest().withStreamId(streamId).withLedgerName(ledgerName);
int retries = 0;
while (retries < MAX_RETRIES) {
DescribeJournalKinesisStreamResult describeStreamResponse = qldb.describeJournalKinesisStream(describeStreamRequest);
String streamStatus = describeStreamResponse.getStream().getStatus();
log.info("Waiting for Stream Completion. Current streamStatus: {}.", streamStatus);
if (streamStatus.equals("COMPLETED")) {
break;
}
try {
Thread.sleep(1000);
} catch (Exception ignore) {
}
retries++;
}
if (retries >= MAX_RETRIES) {
throw new RuntimeException("Kinesis Stream with name " + kdsName + " never went completed.");
}
}
Aggregations