Consume kinesis logs while task is RUNNING status

pull/218/head
Frostebite 2021-02-07 15:53:59 +00:00
parent 6aec635bd4
commit e036cd6b77
2 changed files with 11 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -115,14 +115,20 @@ class AWS {
return tasks.tasks[0].lastStatus;
};
const stream = await kinesis
.describeStream({
StreamName: taskDefResources.StackResources.find(
(x) => x.LogicalResourceId === 'KinesisStream',
).PhysicalResourceId,
})
.promise();
while ((await getTaskStatus()) === 'RUNNING') {
const iterator = await kinesis
.getShardIterator({
ShardIteratorType: 'TRIM_HORIZON',
StreamName: taskDefResources.StackResources.find(
(x) => x.LogicalResourceId === 'KinesisStream',
).PhysicalResourceId,
ShardId: 'example',
StreamName: stream.StreamDescription.StreamName,
ShardId: stream.StreamDescription.Shards[0].ShardId,
})
.promise();
const records = await kinesis