public MySqlOutboxRangeRequestTests()
        {
            _mySqlTestHelper = new MySqlTestHelper();
            _mySqlTestHelper.SetupMessageDb();
            _mySqlOutboxSync = new MySqlOutboxSync(_mySqlTestHelper.OutboxConfiguration);

            _messageEarliest = new Message(new MessageHeader(Guid.NewGuid(), _TopicFirstMessage, MessageType.MT_DOCUMENT), new MessageBody("message body"));
            _message1        = new Message(new MessageHeader(Guid.NewGuid(), "test_topic2", MessageType.MT_DOCUMENT), new MessageBody("message body2"));
            _message2        = new Message(new MessageHeader(Guid.NewGuid(), _TopicLastMessage, MessageType.MT_DOCUMENT), new MessageBody("message body3"));
            _mySqlOutboxSync.Add(_messageEarliest);
            Task.Delay(100);
            _mySqlOutboxSync.Add(_message1);
            Task.Delay(100);
            _mySqlOutboxSync.Add(_message2);
        }
コード例 #2
0
        public MySqlOutboxWritngMessagesTests()
        {
            _mySqlTestHelper = new MySqlTestHelper();
            _mySqlTestHelper.SetupMessageDb();
            _mySqlOutboxSync = new MySqlOutboxSync(_mySqlTestHelper.OutboxConfiguration);

            _messageEarliest = new Message(new MessageHeader(Guid.NewGuid(), "Test", MessageType.MT_COMMAND, DateTime.UtcNow.AddHours(-3)), new MessageBody("Body"));
            _mySqlOutboxSync.Add(_messageEarliest);

            var message2 = new Message(new MessageHeader(Guid.NewGuid(), "Test2", MessageType.MT_COMMAND, DateTime.UtcNow.AddHours(-2)), new MessageBody("Body2"));

            _mySqlOutboxSync.Add(message2);

            _messageLatest = new Message(new MessageHeader(Guid.NewGuid(), "Test3", MessageType.MT_COMMAND, DateTime.UtcNow.AddHours(-1)), new MessageBody("Body3"));
            _mySqlOutboxSync.Add(_messageLatest);
        }
コード例 #3
0
        public MySqlOutboxWritingMessageTests()
        {
            _mySqlTestHelper = new MySqlTestHelper();
            _mySqlTestHelper.SetupMessageDb();
            _mySqlOutboxSync = new MySqlOutboxSync(_mySqlTestHelper.OutboxConfiguration);
            var messageHeader = new MessageHeader(
                messageId: Guid.NewGuid(),
                topic: "test_topic",
                messageType: MessageType.MT_DOCUMENT,
                timeStamp: DateTime.UtcNow.AddDays(-1),
                handledCount: 5,
                delayedMilliseconds: 5,
                correlationId: new Guid(),
                replyTo: "ReplyTo",
                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"));
            _mySqlOutboxSync.Add(_messageEarliest);
        }
コード例 #4
0
        public MySqlOutboxFetchOutstandingMessageTests()
        {
            _mySqlTestHelper = new MySqlTestHelper();
            _mySqlTestHelper.SetupMessageDb();
            _mySqlOutboxSync = new MySqlOutboxSync(_mySqlTestHelper.OutboxConfiguration);

            _messageEarliest = new Message(new MessageHeader(Guid.NewGuid(), _TopicFirstMessage, MessageType.MT_DOCUMENT), new MessageBody("message body"));
            _message1        = new Message(new MessageHeader(Guid.NewGuid(), "test_topic2", MessageType.MT_DOCUMENT), new MessageBody("message body2"));
            _message2        = new Message(new MessageHeader(Guid.NewGuid(), _TopicLastMessage, MessageType.MT_DOCUMENT), new MessageBody("message body3"));
            _mySqlOutboxSync.Add(_messageEarliest);
            Thread.Sleep(100);
            _mySqlOutboxSync.Add(_message1);
            Thread.Sleep(100);
            _mySqlOutboxSync.Add(_message2);

            // Not sure why (assuming time skew) but needs time to settle
            Thread.Sleep(7000);
        }
コード例 #5
0
        public MySqlOutboxMessageAlreadyExistsTests()
        {
            _mySqlTestHelper = new MySqlTestHelper();
            _mySqlTestHelper.SetupMessageDb();

            _mySqlOutboxSync = new MySqlOutboxSync(_mySqlTestHelper.OutboxConfiguration);
            _messageEarliest = new Message(new MessageHeader(Guid.NewGuid(), "test_topic", MessageType.MT_DOCUMENT), new MessageBody("message body"));
            _mySqlOutboxSync.Add(_messageEarliest);
        }
コード例 #6
0
 public void When_The_Message_Is_Already_In_The_Outbox()
 {
     _exception = Catch.Exception(() => _mySqlOutboxSync.Add(_messageEarliest));
     _exception.Should().BeNull();
 }