use of com.amazonaws.services.qldb.model.StreamJournalToKinesisResult in project amazon-qldb-dmv-sample-java by aws-samples.
the class StreamJournal method createQldbStream.
/**
* Create a QLDB Stream.
*
* @return the QLDB Stream description.
* @throws InterruptedException if the thread is interrupted while waiting
* for stream creation.
*/
public static JournalKinesisStreamDescription createQldbStream() throws InterruptedException {
log.info("Creating Kinesis data stream with name: '{}'...", kdsName);
createKdsIfNotExists();
log.info("Creating QLDB stream...");
StreamJournalToKinesisRequest request = new StreamJournalToKinesisRequest().withKinesisConfiguration(getKdsConfig()).withInclusiveStartTime(Date.from(Instant.now().minus(Duration.ofDays(1)))).withRoleArn(getOrCreateKdsRole()).withLedgerName(ledgerName).withStreamName(streamName);
if (exclusiveEndTime != null) {
request = request.withExclusiveEndTime(exclusiveEndTime);
}
StreamJournalToKinesisResult result = qldb.streamJournalToKinesis(request);
streamId = result.getStreamId();
DescribeJournalKinesisStreamResult describeResult = describeQldbStream();
log.info("Created QLDB stream: {} Current status: {}.", streamId, describeResult.getStream().getStatus());
return describeResult.getStream();
}
Aggregations