コード例 #1
0
        public async Task AspectKinesisHandler(KinesisEvent kinesisEvent, ILambdaContext context)
        {
            if (_logger == null)
            {
                _logger = new AspectAwsLambdaLogger.AspectAwsLambdaLogger(context.Logger);  //NOTE: Needed for Test or if using CloudWatch and not using NLog->CloudWatch setup in constructor
            }
            if (_sqsFacade == null)
            {
                _sqsFacade = new AwsSqsFacade(_logger); //NOTE: Needed for Test or if using CloudWatch and not using NLog->CloudWatch setup in constructor
            }
            _logger.Debug($"DynamoDbTableName: {_dynamoDbTableName}");
            _logger.Trace("Beginning AspectKinesisHandler");

            _logger.Info($"Record Count: {kinesisEvent.Records.Count}");

            bool writeEventsToQueue = Convert.ToBoolean(Environment.GetEnvironmentVariable(WRITE_EVENTS_TO_QUEUE_ENVIRONMENT_VARIABLE_LOOKUP));

            _logger.Debug($"WriteEventsToQueue: {writeEventsToQueue}");

            foreach (var record in kinesisEvent.Records)
            {
                await ProcessEventRecord(record, writeEventsToQueue);
            }

            _logger.Trace("Ending AspectKinesisHandler");
        }
コード例 #2
0
        public async Task AspectKinesisHandler(KinesisEvent kinesisEvent, ILambdaContext context)
        {
            if (_logger == null)
            {
                _logger = new AspectAwsLambdaLogger.AspectAwsLambdaLogger(context.Logger);  //NOTE: Needed for Test or if using CloudWatch and not using NLog->CloudWatch setup in constructor
            }
            if (_sqsFacade == null)
            {
                _sqsFacade = new AwsSqsFacade(_logger); //NOTE: Needed for Test or if using CloudWatch and not using NLog->CloudWatch setup in constructor
            }
            _logger.Debug($"DynamoDbTableName: {_dynamoDbTableName}");
            _logger.Trace("Beginning AspectKinesisHandler");

            _logger.Info($"Record Count: {kinesisEvent.Records.Count}");

            var writeEventsToQueue = await ReadWriteEventsToQueueFlag();

            _logger.Debug($"WriteEventsToQueue: {writeEventsToQueue}");

            foreach (var record in kinesisEvent.Records)
            {
                await ProcessEventRecord(record, writeEventsToQueue);
            }

            _logger.Trace("Ending AspectKinesisHandler");
        }