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(); .promise();
while ((await getTaskStatus()) === 'RUNNING') { let iterator = (
const iterator = await kinesis await kinesis
.getShardIterator({ .getShardIterator({
ShardIteratorType: 'TRIM_HORIZON', ShardIteratorType: 'TRIM_HORIZON',
StreamName: stream.StreamDescription.StreamName, StreamName: stream.StreamDescription.StreamName,
ShardId: stream.StreamDescription.Shards[0].ShardId, ShardId: stream.StreamDescription.Shards[0].ShardId,
}) })
.promise(); .promise()
).ShardIterator;
while ((await getTaskStatus()) === 'RUNNING') {
const records = await kinesis const records = await kinesis
.getRecords({ .getRecords({
ShardIterator: iterator.ShardIterator, ShardIterator: iterator.ShardIterator,
}) })
.promise(); .promise();
iterator = records.NextShardIterator;
core.info(Buffer.from(records.Records[0].Data).toString('base64')); core.info(Buffer.from(records.Records[0].Data).toString('base64'));
} }