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

            return(_outgoingFilter.Process(envelope));
        }
        public void ShouldSwallowPersistanceException()
        {
            // Arrange
            Guid messageId = Guid.NewGuid();

            var deduplicationSettings = DeduplicationFilterSettings.Instance;
            deduplicationSettings.DisableMsgExpiry = true;

            _persistor.Setup(i => i.Insert(messageId, It.IsAny<DateTime>())).Throws(new Exception());

            var outgoingFilter = new OutgoingFilter(_persistor.Object);
            var envelope = new Envelope();
            envelope.Headers = new Dictionary<string, object>();
            envelope.Headers = new Dictionary<string, object> { { "MessageId", Encoding.ASCII.GetBytes(messageId.ToString()) } };

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

            // Assert
            Assert.True(result);
        }
示例#3
0
        public bool Process(Envelope envelope)
        {
            var outgoingFilter = new OutgoingFilter(new MessageDeduplicationPersistorInMemory());

            return(outgoingFilter.Process(envelope));
        }
        public bool Process(Envelope envelope)
        {
            var outgoingFilter = new OutgoingFilter(new MessageDeduplicationPersistorMongoDb());

            return outgoingFilter.Process(envelope);
        }