Exemplo n.º 1
0
        public void When_the_message_is_already_in_the_outbox()
        {
            _exception = Catch.Exception(() => _dynamoDbOutbox.Add(_messageEarliest));

            //_should_ignore_the_duplicate_key_and_still_succeed
            _exception.Should().BeNull();
        }
Exemplo n.º 2
0
        public DynamoDbOutboxWritingMessageTests()
        {
            var messageHeader = new MessageHeader(
                messageId: Guid.NewGuid(),
                topic: "test_topic",
                messageType: MessageType.MT_DOCUMENT,
                timeStamp: DateTime.UtcNow.AddDays(-1),
                handledCount: 5,
                delayedMilliseconds: 5,
                correlationId: Guid.NewGuid(),
                replyTo: "ReplyAddress",
                contentType: "text/plain");

            messageHeader.Bag.Add(_key1, _value1);
            messageHeader.Bag.Add(_key2, _value2);
            messageHeader.Bag.Add(_key3, _value3);
            messageHeader.Bag.Add(_key4, _value4);
            messageHeader.Bag.Add(_key5, _value5);

            _messageEarliest = new Message(messageHeader, new MessageBody("message body"));

            _dynamoDbOutbox = new DynamoDbOutbox(Client, new DynamoDbConfiguration(Credentials, RegionEndpoint.EUWest1, TableName));

            _dynamoDbOutbox.Add(_messageEarliest);
        }
Exemplo n.º 3
0
        public DynamoDbOutboxWritingMessageTests()
        {
            var messageHeader = new MessageHeader(Guid.NewGuid(), "test_topic", MessageType.MT_DOCUMENT, DateTime.UtcNow.AddDays(-1), 5, 5);

            messageHeader.Bag.Add(_key1, _value1);
            messageHeader.Bag.Add(_key2, _value2);

            _messageEarliest = new Message(messageHeader, new MessageBody("Body"));
            DynamoDbOutbox.Add(_messageEarliest);
        }
Exemplo n.º 4
0
        public DynamoDbOutboxWritingMessageTests()
        {
            var messageHeader = new MessageHeader(Guid.NewGuid(), "test_topic", MessageType.MT_DOCUMENT, DateTime.UtcNow.AddDays(-1), 5, 5);

            messageHeader.Bag.Add(_key1, _value1);
            messageHeader.Bag.Add(_key2, _value2);
            _dynamoDbOutbox = new DynamoDbOutbox(Client, new DynamoDbConfiguration(Credentials, RegionEndpoint.EUWest1, TableName));

            _messageEarliest = new Message(messageHeader, new MessageBody("Body"));
            _dynamoDbOutbox.Add(_messageEarliest);
        }
        public DynamoDbOutboxRangeRequestTests()
        {
            var messageEarliest = new Message(new MessageHeader(Guid.NewGuid(), _TopicFirstMessage, MessageType.MT_DOCUMENT), new MessageBody("message body"));
            var message1        = new Message(new MessageHeader(Guid.NewGuid(), "test_topic2", MessageType.MT_DOCUMENT), new MessageBody("message body2"));
            var message2        = new Message(new MessageHeader(Guid.NewGuid(), _TopicLastMessage, MessageType.MT_DOCUMENT), new MessageBody("message body3"));

            DynamoDbOutbox.Add(messageEarliest);
            Task.Delay(100);
            DynamoDbOutbox.Add(message1);
            Task.Delay(100);
            DynamoDbOutbox.Add(message2);
        }
        public async Task When_writing_messages_to_the_outbox()
        {
            var guids = new[] { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };

            DynamoDbOutbox.Add(new Message(new MessageHeader(guids[0], "Test", MessageType.MT_COMMAND, DateTime.UtcNow.AddHours(-3)), new MessageBody("Body")));
            DynamoDbOutbox.Add(new Message(new MessageHeader(guids[1], "Test2", MessageType.MT_COMMAND, DateTime.UtcNow.AddHours(-2)), new MessageBody("Body2")));
            DynamoDbOutbox.Add(new Message(new MessageHeader(guids[2], "Test3", MessageType.MT_COMMAND, DateTime.UtcNow.AddHours(-1)), new MessageBody("Body3")));

            var retrievedMessages = (await _dynamoDbTestHelper.Scan()).ToList();

            //_should_read_the_messages_from_the__outbox
            retrievedMessages.Should().HaveCount(3);
            retrievedMessages.Single(m => m.MessageId == guids[0].ToString()).Should().NotBeNull();
            retrievedMessages.Single(m => m.MessageId == guids[1].ToString()).Should().NotBeNull();
            retrievedMessages.Single(m => m.MessageId == guids[2].ToString()).Should().NotBeNull();
        }
Exemplo n.º 7
0
        public DynamoDbRangeOfMessagesTests()
        {
            _guids = new[] { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };

            _messageEarliest =
                new Message(new MessageHeader(_guids[0], _topic, MessageType.MT_COMMAND, _timeStamp.AddHours(-4)), new MessageBody("Body"));
            _message2 = new Message(
                new MessageHeader(_guids[1], _topic, MessageType.MT_COMMAND, _timeStamp.AddHours(-2)), new MessageBody("Body2"));
            _messageLatest =
                new Message(new MessageHeader(_guids[2], _topic, MessageType.MT_COMMAND, _timeStamp.AddHours(-1)), new MessageBody("Body3"));
            _nonTopicMessage =
                new Message(new MessageHeader(_guids[3], "Test2", MessageType.MT_COMMAND, _timeStamp.AddHours(-2)), new MessageBody("Body 4"));

            DynamoDbOutbox.Add(_messageEarliest);
            DynamoDbOutbox.Add(_message2);
            DynamoDbOutbox.Add(_messageLatest);
            DynamoDbOutbox.Add(_nonTopicMessage);
        }
Exemplo n.º 8
0
 public DynamoDbOutboxMessageAlreadyExistsTests()
 {
     _messageEarliest = new Message(new MessageHeader(Guid.NewGuid(), "test_topic", MessageType.MT_DOCUMENT), new MessageBody("message body"));
     DynamoDbOutbox.Add(_messageEarliest);
 }