Ejemplo n.º 1
0
        public async Task RunAsync([QueueTrigger("%QueueName%")] QueueData queueData, ILogger log)
        {
            //Add your new vendor integration factory method here
            Dictionary <string, Func <IDispatchVendor> > additionalDispatchCreatorStrategies
                = new Dictionary <string, Func <IDispatchVendor> > {
                { "SampleSingleSendVendor", () => new SampleSingleSendVendor() }
                };

            //Pass necessary run-time settings here
            DispatchHandler dispatchHandler = new DispatchHandler(_dbConnectionString, _dbName, 5,
                                                                  additionalDispatchCreatorStrategies, string.Empty, int.MinValue);
            await dispatchHandler.ProcessSingleMessage(queueData);
        }
Ejemplo n.º 2
0
        public async Task RunAsync(SQSEvent evnt, ILambdaContext context)
        {
            List <Task> tasks = new List <Task>();

            foreach (var message in evnt.Records)
            {
                //Add your new vendor integration factory method here
                Dictionary <string, Func <IDispatchVendor> > additionalDispatchCreatorStrategies
                    = new Dictionary <string, Func <IDispatchVendor> > {
                    { "SampleSingleSendVendor", () => new SampleSingleSendVendor() }
                    };

                //Pass necessary run-time settings here
                DispatchHandler dispatchHandler = new DispatchHandler(_dbConnectionString, _dbName, 5,
                                                                      additionalDispatchCreatorStrategies, string.Empty, int.MinValue);

                //extracting
                var       base64decoded = Convert.FromBase64String(message.Body);
                var       jsonString    = Encoding.UTF8.GetString(base64decoded);
                QueueData queueData     = JsonConvert.DeserializeObject <QueueData>(jsonString);
                tasks.Add(dispatchHandler.ProcessSingleMessage(queueData));
            }
            await Task.WhenAll(tasks);
        }