예제 #1
0
        static void Main(string[] args)
        {
            _awsConfig = AwsConfig.Read();
            _client = _awsConfig.CreateSQSClient();

            Console.Write("What would you like to call your queue? ");
            var queueName = Console.ReadLine().Trim();

            Console.Write("What is the ARN of your dead letter queue (Hit return for no dead letter queue)?");
            var deadLetterQueueName = Console.ReadLine().Trim();

            try
            {
                var deadLetterQueueArn = string.IsNullOrEmpty(deadLetterQueueName) ? null : LookupDeadLetterQueueArn(deadLetterQueueName);
                var newQueueUrl = CreateQueue(queueName, deadLetterQueueArn);
                Console.WriteLine("New queue url is " + newQueueUrl);
            }
            catch(Exception ex)
            {
                Console.WriteLine("ERROR: " + ex.Message);
            }
            Console.WriteLine();
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
예제 #2
0
        static void Main()
        {
            _awsConfig = AwsConfig.Read();
            _client = _awsConfig.CreateSQSClient();

            Console.WriteLine("Monitoring....");
            Console.WriteLine("Press Ctrl+C to stop");

            while (true)
            {
                Console.WriteLine("Checking");
                var receivedMessage = Receive();
                if (receivedMessage != null)
                {
                    Console.WriteLine("Sending email");
                    Console.WriteLine("    From:    " + receivedMessage.Email.From);
                    Console.WriteLine("    To:      " + receivedMessage.Email.To);
                    Console.WriteLine("    Subject: " + receivedMessage.Email.Subject);

                    //Send email

                    Console.WriteLine("Email sent");

                    DeleteMessageFromQueue(receivedMessage.ReceiptHandle);
                    Console.WriteLine("Removed from queue");
                }
                Thread.Sleep(1000);
            }
        }
예제 #3
0
        public Form1()
        {
            InitializeComponent();

            _awsConfig = AwsConfig.Read();
        }