firehoseProcessor(async (event, context) => { console.log(JSON.stringify(event)) const events = context.parsedFirehoseEvents await Promise.all(events.map(evt => { evt.correlationIds.set('sns-sender', 'firehose') // event has a `logger` attached to it, with the specific correlation IDs for that record evt.logger.debug('publishing firehose event as SNS message...', { event: evt }) const req = { Message: JSON.stringify(evt), TopicArn: process.env.TOPIC_ARN } return SNS.publishWithCorrelationIds(evt.correlationIds, req).promise() })) })
DynamoDBProcessor(async (event, context) => { const events = context.parsedDynamoDbEvents await Promise.all(events.map(async evt => { evt.correlationIds.set('sns-sender', 'dynamodb') // event has a `logger` attached to it, with the specific correlation IDs for that record evt.logger.debug('publishing DynamoDB event as SNS message...', { event: evt }) const req = { Message: JSON.stringify(evt), TopicArn: TOPIC_ARN } await SNS.publishWithCorrelationIds(evt.correlationIds, req).promise() })) })
kinesisProcessor(async (event, context) => { const events = context.parsedKinesisEvents await Promise.all(events.map(async evt => { evt.correlationIds.set('sns-sender', 'kinesis') // event has a `logger` attached to it, with the specific correlation IDs for that record evt.logger.debug('publishing kinesis event as SNS message...', { event: evt }) const req = { Message: JSON.stringify(evt), TopicArn: TOPIC_ARN } await SNS.publishWithCorrelationIds(evt.correlationIds, req).promise() await DynamoDB.putWithCorrelationIds(evt.correlationIds, { TableName: TABLE_NAME, Item: { Id: uuid() } }).promise() })) })
DynamoDBProcessor(async (event, context) => { const events = context.parsedDynamoDbEvents await Promise.all(events.map(async evt => { evt.correlationIds.set('sns-sender', 'dynamodb') // event has a `logger` attached to it, with the specific correlation IDs for that record evt.logger.debug('publishing DynamoDB event as SNS message...', { event: evt }) const req = { Message: JSON.stringify(evt), TopicArn: TOPIC_ARN } await SNS.publishWithCorrelationIds(evt.correlationIds, req).promise() })) })
firehoseProcessor(async (event, context) => { console.log(JSON.stringify(event)) const events = context.parsedFirehoseEvents await Promise.all(events.map(evt => { evt.correlationIds.set('sns-sender', 'firehose') // event has a `logger` attached to it, with the specific correlation IDs for that record evt.logger.debug('publishing firehose event as SNS message...', { event: evt }) const req = { Message: JSON.stringify(evt), TopicArn: process.env.TOPIC_ARN } return SNS.publishWithCorrelationIds(evt.correlationIds, req).promise() })) })
kinesisProcessor(async (event, context) => { const events = context.parsedKinesisEvents await Promise.all(events.map(async evt => { evt.correlationIds.set('sns-sender', 'kinesis') // event has a `logger` attached to it, with the specific correlation IDs for that record evt.logger.debug('publishing kinesis event as SNS message...', { event: evt }) const req = { Message: JSON.stringify(evt), TopicArn: TOPIC_ARN } await SNS.publishWithCorrelationIds(evt.correlationIds, req).promise() await DynamoDB.putWithCorrelationIds(evt.correlationIds, { TableName: TABLE_NAME, Item: { Id: uuid() } }).promise() })) })