コード例 #1
0
ファイル: MqTest.cs プロジェクト: NetCoreTemplates/worker-sqs
        public MqTest()
        {
            sqsFactory = new SqsConnectionFactory(
                "<AWS ACCESS KEY>",
                "<AWS SECRET KEY>",
                RegionEndpoint.USEast1);

            sqsQueueManager = new SqsQueueManager(sqsFactory)
            {
                DisableBuffering = true,
            };

            MqFactory = new SqsMqMessageFactory(sqsQueueManager);

            //Delete all Hello MQ's
            //sqsQueueManager.PurgeQueues(QueueNames<Hello>.AllQueueNames);
        }
コード例 #2
0
        public void Can_publish_and_receive_messages_with_MessageFactory()
        {
            using (var mqFactory = new SqsMqMessageFactory(sqsQueueManager))
            {
                using (var mqClient = mqFactory.CreateMessageQueueClient())
                {
                    mqClient.Publish(new Hello
                    {
                        Name = "Foo"
                    });

                    var msg = mqClient.Get <Hello>(QueueNames <Hello> .In, TimeSpan.FromSeconds(30));

                    Assert.IsNotNull(msg, "Should have received msg from IN queue but did not");
                    Assert.That(msg.GetBody().Name, Is.EqualTo("Foo"));
                }
            }
        }