< Summary

Class:Microsoft.Azure.EventHubs.Processor.PartitionManagerOptions
Assembly:Microsoft.Azure.EventHubs.Processor
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Microsoft.Azure.EventHubs.Processor\src\PartitionManagerOptions.cs
Covered lines:0
Uncovered lines:14
Coverable lines:14
Total lines:67
Line coverage:0% (0 of 14)
Covered branches:0
Total branches:8
Branch coverage:0% (0 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
get_RenewInterval()-0%100%
set_RenewInterval(...)-0%0%
get_LeaseDuration()-0%100%
set_LeaseDuration(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Microsoft.Azure.EventHubs.Processor\src\PartitionManagerOptions.cs

#LineLine coverage
 1// Copyright (c) Microsoft. All rights reserved.
 2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
 3
 4namespace Microsoft.Azure.EventHubs.Processor
 5{
 6    using System;
 7
 8    /// <summary>
 9    /// Options to control various aspects of partition distribution happening within <see cref="EventProcessorHost"/> i
 10    /// </summary>
 11    public class PartitionManagerOptions
 12    {
 13        const int MinLeaseDurationInSeconds = 15;
 14        const int MaxLeaseDurationInSeconds = 60;
 15
 016        TimeSpan renewInterval = TimeSpan.FromSeconds(10);
 017        TimeSpan leaseDuration = TimeSpan.FromSeconds(30);
 18
 19        /// <summary>
 20        /// Renew interval for all leases for partitions currently held by <see cref="EventProcessorHost"/> instance.
 21        /// </summary>
 22        public TimeSpan RenewInterval
 23        {
 24            get
 25            {
 026                return this.renewInterval;
 27            }
 28
 29            set
 30            {
 031                if (value >= this.leaseDuration)
 32                {
 033                    throw new ArgumentException("Renew interval needs to be smaller than the lease duration.");
 34                }
 35
 036                this.renewInterval = value;
 037            }
 38        }
 39
 40        /// <summary>
 41        /// Interval for which the lease is taken on Azure Blob representing an EventHub partition.  If the lease is not
 42        /// interval, it will cause it to expire and ownership of the partition will move to another <see cref="EventPro
 43        /// </summary>
 44        public TimeSpan LeaseDuration
 45        {
 46            get
 47            {
 048                return this.leaseDuration;
 49            }
 50
 51            set
 52            {
 053                if (value <= this.renewInterval)
 54                {
 055                    throw new ArgumentException("Lease duration needs to be greater than the renew interval.");
 56                }
 57
 058                if (value.TotalSeconds < MinLeaseDurationInSeconds || value.TotalSeconds > MaxLeaseDurationInSeconds)
 59                {
 060                    throw new ArgumentException($"Lease duration needs to be between {MinLeaseDurationInSeconds} seconds
 61                }
 62
 063                this.leaseDuration = value;
 064            }
 65        }
 66    }
 67}