Decode kinesis data

pull/218/head
Frostebite 2021-02-07 22:50:13 +00:00
parent d2aca81d39
commit f3c028fc19
2 changed files with 5 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -144,11 +144,12 @@ class AWS {
iterator = records.NextShardIterator; iterator = records.NextShardIterator;
if (records.Records.length > 0) { if (records.Records.length > 0) {
for (let index = 0; index < records.Records.length; index++) { for (let index = 0; index < records.Records.length; index++) {
let json = JSON.parse( const json = JSON.parse(
zlib.gunzipSync(Buffer.from(records.Records[index].Data, 'base64')).toString('utf8'), zlib.gunzipSync(Buffer.from(records.Records[index].Data, 'base64')).toString('utf8'),
); );
if("DATA_MESSAGE") if (json.messageType === 'DATA_MESSAGE') {
core.info(json.message,); core.info(json.message);
}
} }
} }
await new Promise((resolve) => setTimeout(resolve, 3000)); await new Promise((resolve) => setTimeout(resolve, 3000));