/// <summary>
        /// Initializes a new instance of the <see cref="ProducerRecoveryManager"/> class
        /// </summary>
        /// <param name="producer">A <see cref="IProducer"/> for which status is tracked</param>
        /// <param name="recoveryOperation">A <see cref="IRecoveryOperation"/> used to issue and track recovery operations</param>
        /// <param name="timestampTracker">A <see cref="ITimestampTracker"/> used to track message timings</param>
        internal ProducerRecoveryManager(IProducer producer, IRecoveryOperation recoveryOperation, ITimestampTracker timestampTracker)
        {
            Guard.Argument(producer, nameof(producer)).NotNull();
            Guard.Argument(recoveryOperation, nameof(recoveryOperation)).NotNull();
            Guard.Argument(timestampTracker, nameof(timestampTracker)).NotNull();

            Producer           = producer;
            _producer          = (Producer)producer;
            _recoveryOperation = recoveryOperation;
            _timestampTracker  = timestampTracker;

            Status = ProducerRecoveryStatus.NotStarted;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProducerRecoveryManager"/> class
        /// </summary>
        /// <param name="producer">A <see cref="IProducer"/> for which status is tracked</param>
        /// <param name="recoveryOperation">A <see cref="IRecoveryOperation"/> used to issue and track recovery operations</param>
        /// <param name="timestampTracker">A <see cref="ITimestampTracker"/> used to track message timings</param>
        internal ProducerRecoveryManager(IProducer producer, IRecoveryOperation recoveryOperation, ITimestampTracker timestampTracker)
        {
            Contract.Requires(producer != null);
            Contract.Requires(recoveryOperation != null);
            Contract.Requires(timestampTracker != null);

            Producer           = producer;
            _producer          = (Producer)producer;
            _recoveryOperation = recoveryOperation;
            _timestampTracker  = timestampTracker;

            Status = ProducerRecoveryStatus.NotStarted;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProducerRecoveryManager"/> class
        /// </summary>
        /// <param name="producer">A <see cref="IProducer"/> for which status is tracked</param>
        /// <param name="recoveryOperation">A <see cref="IRecoveryOperation"/> used to issue and track recovery operations</param>
        /// <param name="timestampTracker">A <see cref="ITimestampTracker"/> used to track message timings</param>
        /// <param name="minIntervalBetweenRecoveryRequests">The minimal interval between recovery requests initiated by alive messages (seconds)</param>
        internal ProducerRecoveryManager(IProducer producer, IRecoveryOperation recoveryOperation, ITimestampTracker timestampTracker, int minIntervalBetweenRecoveryRequests)
        {
            Guard.Argument(producer, nameof(producer)).NotNull();
            Guard.Argument(recoveryOperation, nameof(recoveryOperation)).NotNull();
            Guard.Argument(timestampTracker, nameof(timestampTracker)).NotNull();

            Producer           = producer;
            _producer          = (Producer)producer;
            _recoveryOperation = recoveryOperation;
            _timestampTracker  = timestampTracker;
            _minIntervalBetweenRecoveryRequests = minIntervalBetweenRecoveryRequests;

            Status = ProducerRecoveryStatus.NotStarted;
            _lastRecoveryMessage     = DateTime.Now;
            _connectionDownTimestamp = DateTime.MinValue;
        }