Search in sources :

Example 1 with JournalKinesisStreamDescription

use of com.amazonaws.services.qldb.model.JournalKinesisStreamDescription in project amazon-qldb-dmv-sample-java by aws-samples.

the class StreamJournal method listQldbStreamsForLedger.

/**
 * List QLDB streams for the ledger.
 *
 * @return map of stream Id to description for the ledger's QLDB streams.
 */
public static Map<String, JournalKinesisStreamDescription> listQldbStreamsForLedger() {
    Map<String, JournalKinesisStreamDescription> streams = new HashMap<>();
    String nextToken = null;
    do {
        ListJournalKinesisStreamsForLedgerRequest listRequest = new ListJournalKinesisStreamsForLedgerRequest().withLedgerName(ledgerName).withNextToken(nextToken);
        ListJournalKinesisStreamsForLedgerResult listResult = qldb.listJournalKinesisStreamsForLedger(listRequest);
        listResult.getStreams().forEach(streamDescription -> streams.put(streamDescription.getStreamId(), streamDescription));
        nextToken = listResult.getNextToken();
    } while (nextToken != null);
    return streams;
}
Also used : ListJournalKinesisStreamsForLedgerRequest(com.amazonaws.services.qldb.model.ListJournalKinesisStreamsForLedgerRequest) HashMap(java.util.HashMap) ListJournalKinesisStreamsForLedgerResult(com.amazonaws.services.qldb.model.ListJournalKinesisStreamsForLedgerResult) JournalKinesisStreamDescription(com.amazonaws.services.qldb.model.JournalKinesisStreamDescription)

Aggregations

JournalKinesisStreamDescription (com.amazonaws.services.qldb.model.JournalKinesisStreamDescription)1 ListJournalKinesisStreamsForLedgerRequest (com.amazonaws.services.qldb.model.ListJournalKinesisStreamsForLedgerRequest)1 ListJournalKinesisStreamsForLedgerResult (com.amazonaws.services.qldb.model.ListJournalKinesisStreamsForLedgerResult)1 HashMap (java.util.HashMap)1