void InvalidPartitionManagerOptions()
        {
            var pmo = new PartitionManagerOptions()
            {
                LeaseDuration = TimeSpan.FromSeconds(30),
                RenewInterval = TimeSpan.FromSeconds(20)
            };

            Assert.ThrowsAsync <ArgumentException>(() =>
            {
                TestUtility.Log("Setting lease duration smaller than the renew interval should fail.");
                pmo.LeaseDuration = TimeSpan.FromSeconds(15);
                throw new InvalidOperationException("Setting LeaseDuration should have failed");
            }).Wait();

            Assert.ThrowsAsync <ArgumentException>(() =>
            {
                TestUtility.Log("Setting renew interval greater than the lease duration should fail.");
                pmo.RenewInterval = TimeSpan.FromSeconds(45);
                throw new InvalidOperationException("Setting RenewInterval should have failed.");
            }).Wait();

            Assert.ThrowsAsync <ArgumentException>(() =>
            {
                TestUtility.Log("Setting lease duration outside of allowed range should fail.");
                pmo.LeaseDuration = TimeSpan.FromSeconds(65);
                throw new InvalidOperationException("Setting LeaseDuration should have failed.");
            }).Wait();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs a new instance.
        /// </summary>
        /// <param name="options">The optional <see cref="EventProcessorOptions"/> to use when receiving events.</param>
        /// <param name="partitionOptions">Optional <see cref="PartitionManagerOptions"/> to use to configure any EventProcessorHosts. </param>
        public EventHubConfiguration(
            EventProcessorOptions options,
            PartitionManagerOptions partitionOptions = null)
        {
            if (options == null)
            {
                options = EventProcessorOptions.DefaultOptions;
                options.MaxBatchSize = 1000;
            }
            _partitionOptions = partitionOptions;

            _options = options;
        }
Ejemplo n.º 3
0
 public EventHubOptions()
 {
     EventProcessorOptions   = EventProcessorOptions.DefaultOptions;
     PartitionManagerOptions = new PartitionManagerOptions();
 }