- Enable and disable Stream
You can specify whether Stream is enabled or disabled when creating a table. Also, you can use the
UpdateTableoperation to enable or disable Stream later. The
UpdateTableoperations now include a
StreamSpecificationparameter that allows you to set Stream parameters:
- enable_stream: Whether to enable Stream.
- expiration_time: Stream data expiration time. Expired modification log entries are deleted.
- Read modification logs
To read Stream data, follow these steps:
ListStreamsto obtain the current table’s Stream information, such as Stream ID. For more information, see ListStream.
DescribeStreamto obtain the current Stream’s data shard information, such as the shard list. Each shard log contains shard information such as the parent shard and shardID. For more information, see DescribeStream.
- After obtaining StreamID and shardID, use
GetShardIteratorto obtain the current shard’s read iterator value. This value marks the starting position for reading the shard log. For more information, see GetShardIterator.
GetStreamRecordto read the specific modification logs. Each call returns a new iterator for the next read to use. For more information, see GetStreamRecord.
- Operations made to the same primary key have to be sequenced. Stream makes sure that operations made to the same shard are sequenced. However, shards may be split or merged, so before you read the data of a shard, make sure that data of the shard’s parent shard and parent_sibling has been read.
- When an empty
NextShardIteratoris returned, it indicates that incremental data in the current shard has been fully read. This situation occurs typically when the shard is inactive after a split or merge operation. When a shard has been fully read, you can call
DescribeStreamagain to retrieve information about the new shard.
Table Store Java SDK supports the Stream interface. For more information, see Java SDK.