在下面的示例中,如果我已经知道插入数据时返回的序列号,则可以返回记录。 但是,如何返回不同设备添加的所有数据?
import boto
mykin = boto.connect_kinesis(aws_access_key_id='access_key',
aws_secret_access_key='secret_key')
myput = mykin.put_record(stream_name='mytest', data='abcdefghij',
partition_key='parti11', b64_encode=True)
myiterator = mykin.get_shard_iterator(stream_name='mytest',
shard_id='shardId-000000000000',
shard_iterator_type='AT_SEQUENCE_NUMBER',
starting_sequence_number=
myput['SequenceNumber'])
mykin.get_records(shard_iterator=myiterator['ShardIterator'])
答案 0 :(得分:1)
在您的制片人中:
kinesis = boto.kinesis.connect_to_region('us-east-1', aws_access_key_id, aws_secret_access_key)
response = kinesis.describe_stream('stream_name')
shard_id = response['StreamDescription']['Shards'][0]['ShardId']
response = kinesis.get_shard_iterator('stream_name', shard_id, 'TRIM_HORIZON')