Пример #1
0
        public async Task ComeOn_Sqs()
        {
            var queueName = Guid.NewGuid().ToString("N");

            Using(new QueueDeleter(queueName));

            AmazonSqsManyMessagesTransportFactory.PurgeQueue(queueName);

            using var errorQueueTransport = AmazonSqsTransportFactory.CreateTransport("error", TimeSpan.FromMinutes(1));

            var info = AmazonSqsTransportFactory.ConnectionInfo;

            using var activator = new BuiltinHandlerActivator();

            activator.Register((bús, context) => new TestMessageHandler(context, bús.Advanced.TransportMessage));

            var bus = Configure.With(activator)
                      .Logging(l => l.None())
                      .Transport(t => t.UseAmazonSQS(info.AccessKeyId, info.SecretAccessKey, info.RegionEndpoint, queueName))
                      .Options(o => o.SimpleRetryStrategy(secondLevelRetriesEnabled: true))
                      .Start();

            await bus.SendLocal(new TestMessage("yo!"));

            var message = await errorQueueTransport.WaitForNextMessage(timeoutSeconds : 25);

            Assert.That(message.DeserializeTo <TestMessage>().Text, Is.EqualTo("yo!"));
        }
Пример #2
0
 protected override void SetUp()
 {
     _inputQueueAddress = $"queue-{DateTime.Now:yyyyMMdd-HHmmss}";
     _transport         = AmazonSqsTransportFactory.CreateTransport(_inputQueueAddress, TimeSpan.FromMinutes(1));
     Using(_transport);
 }