Provides uniform implementation of the (incoming filter) message deduplication for all the different types of filters with various persistence mechanisms.
        public bool Process(Envelope envelope)
        {
            if (null == _incomingFilter)
            {
                _incomingFilter = new IncomingFilter(new MessageDeduplicationPersistorMongoDbSsl());
            }

            return(_incomingFilter.Process(envelope));
        }
コード例 #2
0
        public void ShouldProcessNewMessageWhenRedeliveredFlagIsNotSet()
        {
            // Arrange
            var incomingFilter = new IncomingFilter(_persistor.Object);
            var envelope = new Envelope();
            envelope.Headers = new Dictionary<string, object>();

            // Act
            var result = incomingFilter.Process(envelope);

            // Assert
            Assert.True(result);
        }
コード例 #3
0
        public void ShouldProcessNewMessageWhenRedeliveredFlagIsSet()
        {
            // Arrange
            var incomingFilter = new IncomingFilter(_persistor.Object);
            Guid messageId = Guid.NewGuid();
            var envelope = new Envelope();
            envelope.Headers = new Dictionary<string, object> { { "Redelivered", true }, { "MessageId",  Encoding.ASCII.GetBytes(messageId.ToString()) } };

            // Act
            var result = incomingFilter.Process(envelope);

            // Assert
            Assert.True(result);
        }
コード例 #4
0
        public void ShouldNotProcessDuplicateMessageWhenRedeliveredFlagIsSet()
        {
            // Arrange
            Guid messageId = Guid.NewGuid();
            _persistor.Setup(i => i.GetMessageExists(messageId)).Returns(true);
            var incomingFilter = new IncomingFilter(_persistor.Object);
            var envelope = new Envelope();
            envelope.Headers = new Dictionary<string, object> { { "Redelivered", true }, { "MessageId", Encoding.ASCII.GetBytes(messageId.ToString()) } };

            // Act
            var result = incomingFilter.Process(envelope);

            // Assert
            Assert.False(result);
        }
コード例 #5
0
        public bool Process(Envelope envelope)
        {
            var incomingFilter = new IncomingFilter(new MessageDeduplicationPersistorInMemory());

            return(incomingFilter.Process(envelope));
        }
        public bool Process(Envelope envelope)
        {
            var incomingFilter = new IncomingFilter(new MessageDeduplicationPersistorMongoDbSsl());

            return incomingFilter.Process(envelope);
        }
コード例 #7
0
        public void ShouldRethrowAnyInternalException()
        {
            // Arrange
            Guid messageId = Guid.NewGuid();
            _persistor.Setup(i => i.GetMessageExists(messageId)).Throws(new Exception());
            var incomingFilter = new IncomingFilter(_persistor.Object);
            var envelope = new Envelope();
            envelope.Headers = new Dictionary<string, object> { { "Redelivered", true }, { "MessageId", Encoding.ASCII.GetBytes(messageId.ToString()) } };

            // Act / Assert
            Assert.Throws<Exception>(() => incomingFilter.Process(envelope));
        }