Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueTransportOptions"/> class.
        /// </summary>
        /// <param name="sntpTimeConfiguration">The SNTP time configuration.</param>
        /// <param name="delayedProcessingConfiguration">The delayed processing configuration.</param>
        public RedisQueueTransportOptions(SntpTimeConfiguration sntpTimeConfiguration,
                                          DelayedProcessingConfiguration delayedProcessingConfiguration)
        {
            Guard.NotNull(() => sntpTimeConfiguration, sntpTimeConfiguration);
            Guard.NotNull(() => delayedProcessingConfiguration, delayedProcessingConfiguration);

            _clearExpiredMessagesBatchLimit = 50;
            _moveDelayedMessagesBatchLimit  = 50;
            _resetHeartBeatBatchLimit       = 50;
            DelayedProcessingConfiguration  = delayedProcessingConfiguration;
            SntpTimeConfiguration           = sntpTimeConfiguration;
        }
        public void Create()
        {
            var test = new SntpTimeConfiguration();

            Assert.Equal(TimeSpan.FromSeconds(900), test.RefreshTime);
            Assert.Equal(123, test.Port);
            Assert.Equal("pool.ntp.org", test.Server);

            test.RefreshTime = TimeSpan.FromSeconds(100);
            Assert.Equal(TimeSpan.FromSeconds(100), test.RefreshTime);

            test.Port = 567;
            Assert.Equal(567, test.Port);

            test.Server = "test";
            Assert.Equal("test", test.Server);
        }
        public void Create_Default()
        {
            var sntpTime = new SntpTimeConfiguration();
            var delay    = new DelayedProcessingConfiguration();
            var test     = new RedisQueueTransportOptions(sntpTime,
                                                          delay);

            Assert.Equal(sntpTime, test.SntpTimeConfiguration);
            Assert.Equal(delay, test.DelayedProcessingConfiguration);

            test.ClearExpiredMessagesBatchLimit = 1000;
            Assert.Equal(1000, test.ClearExpiredMessagesBatchLimit);

            test.MessageIdLocation = MessageIdLocations.Custom;
            Assert.Equal(MessageIdLocations.Custom, test.MessageIdLocation);

            test.MoveDelayedMessagesBatchLimit = 1000;
            Assert.Equal(1000, test.MoveDelayedMessagesBatchLimit);

            test.TimeServer = TimeLocations.Custom;
            Assert.Equal(TimeLocations.Custom, test.TimeServer);
        }