Search in sources :

Example 1 with StreamJournalToKinesisResult

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();
}
Also used : StreamJournalToKinesisResult(com.amazonaws.services.qldb.model.StreamJournalToKinesisResult) DescribeJournalKinesisStreamResult(com.amazonaws.services.qldb.model.DescribeJournalKinesisStreamResult) StreamJournalToKinesisRequest(com.amazonaws.services.qldb.model.StreamJournalToKinesisRequest)

Aggregations

DescribeJournalKinesisStreamResult (com.amazonaws.services.qldb.model.DescribeJournalKinesisStreamResult)1 StreamJournalToKinesisRequest (com.amazonaws.services.qldb.model.StreamJournalToKinesisRequest)1 StreamJournalToKinesisResult (com.amazonaws.services.qldb.model.StreamJournalToKinesisResult)1