Skip to content

TableStreams

Source: src/AWS/Keyspaces/TableStreams.ts

Runtime binding for the Amazon Keyspaces CDC streams data-plane API (cassandra:ListStreams / GetStream / GetShardIterator / GetRecords).

Bind this to a Table whose cdcSpecification is enabled to get a typed client for traversing the table’s change-data-capture stream.

const streams = yield* AWS.Keyspaces.TableStreams(table);
const { streams: available } = yield* streams.listStreams();
const streamArn = available![0].streamArn;
const stream = yield* streams.getStream({ streamArn });
const { shardIterator } = yield* streams.getShardIterator({
streamArn,
shardId: stream.shards![0].shardId!,
shardIteratorType: "TRIM_HORIZON",
});
const { changeRecords } = yield* streams.getRecords({
shardIterator: shardIterator!,
});