init()

in index.js [256:283]


        init(function (err) {
            if (err) {
                finish(err, ERROR);
            } else {
                // parse the stream name out of the event
                var streamName = exports.getStreamName(event.Records[0].eventSourceARN);

                // create the processor to handle each record
                var processor = exports.processEvent.bind(undefined, event, serviceName, streamName, function (err) {
                    if (err) {
                        finish(err, ERROR, "Error Processing Records");
                    } else {
                        finish(undefined, OK);
                    }
                });

                if (deliveryStreamMapping.length === 0 || !deliveryStreamMapping[streamName]) {
                    // no delivery stream cached so far, so add this stream's
                    // tag
                    // value
                    // to the delivery map, and continue with processEvent
                    exports.buildDeliveryMap(streamName, serviceName, context, event, processor);
                } else {
                    // delivery stream is cached so just invoke the processor
                    processor();
                }
            }
        });