Consume kinesis logs while task is RUNNING status

pull/218/head
Frostebite 2021-02-07 15:59:57 +00:00
parent 6f6177a915
commit 07051a9c9a
2 changed files with 8 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -123,19 +123,23 @@ class AWS {
})
.promise();
while ((await getTaskStatus()) === 'RUNNING') {
const iterator = await kinesis
let iterator = (
await kinesis
.getShardIterator({
ShardIteratorType: 'TRIM_HORIZON',
StreamName: stream.StreamDescription.StreamName,
ShardId: stream.StreamDescription.Shards[0].ShardId,
})
.promise();
.promise()
).ShardIterator;
while ((await getTaskStatus()) === 'RUNNING') {
const records = await kinesis
.getRecords({
ShardIterator: iterator.ShardIterator,
})
.promise();
iterator = records.NextShardIterator;
core.info(Buffer.from(records.Records[0].Data).toString('base64'));
}