Esempio n. 1
0
 internal SessionsController(ITimeoutManager <Guid> sessions, ObjectCache sessionsCache, ISessionsRepository repo, IServiceLogRepository log)
 {
     _sessions      = sessions;
     _sessionsCache = sessionsCache;
     _repo          = repo;
     _log           = log;
 }
Esempio n. 2
0
        /// <summary>
        /// Constructs the step, using the specified <see cref="ITimeoutManager"/> to defer relevant messages
        /// and the specified <see cref="ITransport"/> to deliver messages when they're due.
        /// </summary>
        public HandleDeferredMessagesStep(ITimeoutManager timeoutManager, ITransport transport, Options options, IRebusLoggerFactory rebusLoggerFactory, IAsyncTaskFactory asyncTaskFactory)
        {
            if (timeoutManager == null)
            {
                throw new ArgumentNullException(nameof(timeoutManager));
            }
            if (transport == null)
            {
                throw new ArgumentNullException(nameof(transport));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (rebusLoggerFactory == null)
            {
                throw new ArgumentNullException(nameof(rebusLoggerFactory));
            }
            if (asyncTaskFactory == null)
            {
                throw new ArgumentNullException(nameof(asyncTaskFactory));
            }

            _timeoutManager = timeoutManager;
            _transport      = transport;
            _options        = options;
            _log            = rebusLoggerFactory.GetCurrentClassLogger();

            var dueTimeoutsPollIntervalSeconds = (int)options.DueTimeoutsPollInterval.TotalSeconds;
            var intervalToUse = dueTimeoutsPollIntervalSeconds >= 1 ? dueTimeoutsPollIntervalSeconds : 1;

            _dueMessagesSenderBackgroundTask = asyncTaskFactory.Create(DueMessagesSenderTaskName, TimerElapsed, intervalSeconds: intervalToUse);
        }
Esempio n. 3
0
        /// <summary>
        /// Constructs the step, using the specified <see cref="ITimeoutManager"/> to defer relevant messages
        /// and the specified <see cref="ITransport"/> to deliver messages when they're due.
        /// </summary>
        public HandleDeferredMessagesStep(ITimeoutManager timeoutManager, ITransport transport, Options options, IRebusLoggerFactory rebusLoggerFactory, IAsyncTaskFactory asyncTaskFactory)
        {
            _timeoutManager = timeoutManager;
            _transport = transport;
            _options = options;
            _log = rebusLoggerFactory.GetCurrentClassLogger();

            _dueMessagesSenderBackgroundTask = asyncTaskFactory.Create(DueMessagesSenderTaskName, TimerElapsed, intervalSeconds: 1);
        }
Esempio n. 4
0
        /// <summary>
        /// Constructs the step, using the specified <see cref="ITimeoutManager"/> to defer relevant messages
        /// and the specified <see cref="ITransport"/> to deliver messages when they're due.
        /// </summary>
        public HandleDeferredMessagesStep(ITimeoutManager timeoutManager, ITransport transport, Options options, IRebusLoggerFactory rebusLoggerFactory, IAsyncTaskFactory asyncTaskFactory)
        {
            _timeoutManager = timeoutManager;
            _transport      = transport;
            _options        = options;
            _log            = rebusLoggerFactory.GetCurrentClassLogger();

            _dueMessagesSenderBackgroundTask = asyncTaskFactory.Create(DueMessagesSenderTaskName, TimerElapsed, intervalSeconds: 1);
        }
        /// <summary>
        /// Constructs the step, using the specified <see cref="ITimeoutManager"/> to defer relevant messages
        /// and the specified <see cref="ITransport"/> to deliver messages when they're due.
        /// </summary>
        public HandleDeferredMessagesStep(ITimeoutManager timeoutManager, ITransport transport)
        {
            _timeoutManager = timeoutManager;
            _transport = transport;

            _dueMessagesSenderBackgroundTask = new AsyncTask("DueMessagesSender", TimerElapsed)
            {
                Interval = TimeSpan.FromSeconds(1)
            };
        }
Esempio n. 6
0
        protected virtual ITimeoutManager <T> CreateTimeoutManager(int timeoutValue)
        {
            ITimeoutManager <T> timeoutManager = this.timeoutManagerFactory.CreateTimeoutManager <T>(timeoutValue);

            timeoutManager.ItemTimedOut += RaiseTimeoutEvents;

            Trace.TraceInformation("Adding timeout manager with a timeout value of '{0}'", timeoutValue);

            return(timeoutManager);
        }
Esempio n. 7
0
        /// <summary>
        /// Constructs the step, using the specified <see cref="ITimeoutManager"/> to defer relevant messages
        /// and the specified <see cref="ITransport"/> to deliver messages when they're due.
        /// </summary>
        public HandleDeferredMessagesStep(ITimeoutManager timeoutManager, ITransport transport)
        {
            _timeoutManager = timeoutManager;
            _transport      = transport;

            _dueMessagesSenderBackgroundTask = new AsyncTask("DueMessagesSender", TimerElapsed)
            {
                Interval = TimeSpan.FromSeconds(1)
            };
        }
Esempio n. 8
0
        /// <summary>
        /// Constructs the step, using the specified <see cref="ITimeoutManager"/> to defer relevant messages
        /// and the specified <see cref="ITransport"/> to deliver messages when they're due.
        /// </summary>
        public HandleDeferredMessagesStep(ITimeoutManager timeoutManager, ITransport transport, Options options, IRebusLoggerFactory rebusLoggerFactory)
        {
            _timeoutManager = timeoutManager;
            _transport      = transport;
            _options        = options;
            _log            = rebusLoggerFactory.GetCurrentClassLogger();

            _dueMessagesSenderBackgroundTask = new AsyncTask(DueMessagesSenderTaskName, TimerElapsed, rebusLoggerFactory)
            {
                Interval = TimeSpan.FromSeconds(1)
            };
        }
        /// <summary>
        /// Constructs the step, using the specified <see cref="ITimeoutManager"/> to defer relevant messages
        /// and the specified <see cref="ITransport"/> to deliver messages when they're due.
        /// </summary>
        public HandleDeferredMessagesStep(ITimeoutManager timeoutManager, ITransport transport, Options options, IRebusLoggerFactory rebusLoggerFactory)
        {
            _timeoutManager = timeoutManager;
            _transport = transport;
            _options = options;
            _log = rebusLoggerFactory.GetCurrentClassLogger();

            _dueMessagesSenderBackgroundTask = new AsyncTask(DueMessagesSenderTaskName, TimerElapsed, rebusLoggerFactory)
            {
                Interval = TimeSpan.FromSeconds(1)
            };
        }
        /// <summary>
        /// Constructs the step, using the specified <see cref="ITimeoutManager"/> to defer relevant messages
        /// and the specified <see cref="ITransport"/> to deliver messages when they're due.
        /// </summary>
        public HandleDeferredMessagesStep(ITimeoutManager timeoutManager, ITransport transport, Options options, IRebusLoggerFactory rebusLoggerFactory, IAsyncTaskFactory asyncTaskFactory)
        {
            if (timeoutManager == null) throw new ArgumentNullException(nameof(timeoutManager));
            if (transport == null) throw new ArgumentNullException(nameof(transport));
            if (options == null) throw new ArgumentNullException(nameof(options));
            if (rebusLoggerFactory == null) throw new ArgumentNullException(nameof(rebusLoggerFactory));
            if (asyncTaskFactory == null) throw new ArgumentNullException(nameof(asyncTaskFactory));

            _timeoutManager = timeoutManager;
            _transport = transport;
            _options = options;
            _log = rebusLoggerFactory.GetCurrentClassLogger();

            var dueTimeoutsPollIntervalSeconds = (int)options.DueTimeoutsPollInterval.TotalSeconds;
            var intervalToUse = dueTimeoutsPollIntervalSeconds >= 1 ? dueTimeoutsPollIntervalSeconds : 1;

            _dueMessagesSenderBackgroundTask = asyncTaskFactory.Create(DueMessagesSenderTaskName, TimerElapsed, intervalSeconds: intervalToUse);
        }
Esempio n. 11
0
        /// <summary>
        /// Constructs the step, using the specified <see cref="ITimeoutManager"/> to defer relevant messages
        /// and the specified <see cref="ITransport"/> to deliver messages when they're due.
        /// </summary>
        public HandleDeferredMessagesStep(ITimeoutManager timeoutManager, ITransport transport, Options options, IRebusLoggerFactory rebusLoggerFactory, IAsyncTaskFactory asyncTaskFactory)
        {
            if (rebusLoggerFactory == null)
            {
                throw new ArgumentNullException(nameof(rebusLoggerFactory));
            }
            if (asyncTaskFactory == null)
            {
                throw new ArgumentNullException(nameof(asyncTaskFactory));
            }

            _timeoutManager = timeoutManager ?? throw new ArgumentNullException(nameof(timeoutManager));
            _transport      = transport ?? throw new ArgumentNullException(nameof(transport));
            _options        = options ?? throw new ArgumentNullException(nameof(options));

            _log = rebusLoggerFactory.GetLogger <HandleDeferredMessagesStep>();

            _dueMessagesSenderBackgroundTask = asyncTaskFactory.Create(DueMessagesSenderTaskName, TimerElapsed, interval: options.DueTimeoutsPollInterval);
        }
Esempio n. 12
0
 protected override void SetUp()
 {
     _factory        = new TTimeoutManagerFactory();
     _timeoutManager = _factory.Create();
 }
Esempio n. 13
0
 internal RTLookupService(ResultHandler <ReconnectAttempt> reconnectAttemptListener, ITimeoutManager timeOutManager)
 {
     this.reconnectAttemptListener = reconnectAttemptListener;
     this.timeOutManager           = timeOutManager;
 }
Esempio n. 14
0
        public bool CountTimeout(T timeoutItem, TimeSpan timeoutTimeSpan)
        {
            ITimeoutManager <T> timeoutManager = GetOrCreateTimeoutManager((int)timeoutTimeSpan.TotalMilliseconds);

            return(timeoutManager.CountTimeout(timeoutItem));
        }