- Create the project from the following template:
$ sls create --template-url https://github.com/danteinc/js-cloud-native-cookbook/tree/master/ch9/frp-batching --path cncb-frp-batching
- Navigate to the cncb-frp-batching directory, cd cncb-frp-batching.
- Review the file named serverless.yml.
- Review the file named handler.js with the following content:
module.exports.listener = (event, context, cb) => { _(event.Records) .map(recordToUow) .filter(forPurple) .ratelimit(Number(process.env.WRITE_CAPACITY) / Number(process.env.SHARD_COUNT) / Number(process.env.WRITE_BATCH_SIZE) / 10, 100) .batch(Number(process.env.WRITE_BATCH_SIZE)) .map(batchUow) .flatMap(batchWrite) .collect().toCallback(cb);};const batchUow = batch => ({ batch ...