Ejemplo n.º 1
0
        public SQS_Consumer(AppConfig appConfig)
        {
            _awsConfig = appConfig;


            AmazonSQSConfig amazonSQSConfig = new AmazonSQSConfig();

            try
            {
                var config = new AmazonSQSConfig()
                {
                    RegionEndpoint = Amazon.RegionEndpoint.USEast1

                                     //ServiceURL = "https://sqs.us-east-1.amazonaws.com/283124460764/NewProvisioning" // Region and URL
                };

                //_messageRequest.QueueUrl = _appConfig.AwsQueueURL;

                var awsCredentials = new AwsCredentials(_awsConfig);


                _client = new AmazonSQSClient(awsCredentials, config);


                //Create object for DB Operations
                transactionRecord = new TransactionsRecord(awsCredentials);
            }

            catch (Exception ex)
            {
            }
        }
        //Read records from DB.
        //Filter records with Error
        //Push the errorneous records for retry in SQS
        public async Task <string> FunctionHandler(object input, ILambdaContext context)
        {
            _appConfig = new AppConfig();
            _appConfig.AwsAccessKey = "XXX";
            _appConfig.AwsSecretKey = "YYY";

            AwsCredentials awsCredentials = new AwsCredentials(_appConfig);

            _client = new SQS_Consumer(_appConfig);


            transactionRecord = new TransactionsRecord(awsCredentials);

            await ProcessErrorRecord();

            return("success");
        }