Esempio n. 1
0
        static void Main(string[] args)
        {
            var s3Client   = new AmazonS3Client();
            var sqsClient  = new AmazonSQSClient();
            var snsClient  = new AmazonSimpleNotificationServiceClient();
            var s3Request  = new S3Request(s3Client);
            var sqsService = new SQSService(sqsClient);
            var snsService = new SNSService(snsClient, sqsClient);

            var locations = s3Request.CreateLocationsList();

            foreach (var loc in locations)
            {
                Console.WriteLine($"Location id: {loc.Id} had coordinates x: {loc.X} and y: {loc.Y}");
            }

            var processor = new MessageProcessor(sqsService);

            using (var queue = new SQSQueue(sqsService, snsService))
            {
                var endTime = DateTime.Now.AddMinutes(1);
                while (DateTime.Now < endTime)
                {
                    processor.ProcessMessages(queue.QueueUrl);
                }
            };

            Console.WriteLine("monitoring complete...");
        }
Esempio n. 2
0
        public SQSQueue(SQSService sqsService, SNSService snsService)
        {
            _sqsService = sqsService;
            _snsService = snsService;

            QueueUrl         = sqsService.CreateQueueAsync().Result;
            _subscriptionArn = _snsService.SubscribeQueueAsync(QueueUrl).Result;
        }
Esempio n. 3
0
 public MessageProcessor(SQSService sqsService)
 {
     _sqsService = sqsService;
 }