private void ConfigureInstance(ILogger logger, IMetricFactory metricFactory, FixedProcessorClientOptions options, ILeaseManager leaseManager, ICheckpointManager checkpointManager)
        {
            Guard.NotNull(nameof(logger), logger);
            Guard.NotNull(nameof(leaseManager), leaseManager);
            Guard.NotNull(nameof(checkpointManager), checkpointManager);
            Guard.NotNull(nameof(options), options);
            Guard.NotNull(nameof(metricFactory), metricFactory);

            _leaseManager      = leaseManager;
            _checkpointManager = checkpointManager;
            _options           = options;
            _logger            = logger;
            _metricFactory     = metricFactory;

            _errorCounter                  = _metricFactory.CreateCounter("fpc-processing-error-count", "The number of processing errors raised since the start of the processor.", false, new string[0]);
            _partitionStopProcessing       = _metricFactory.CreateCounter("fpc-partition-stop-count", "The number of processing stop events raised since the start of the processor.", false, new string[0]);
            _partitionInitializeProcessing = _metricFactory.CreateCounter("fpc-partition-init-count", "The number of processing initialization events raised since the start of the processor.", false, new string[0]);
        }
 /// <summary>
 /// Initializes a new instance of the type
 /// </summary>
 /// <param name="credential">The Azure managed identity credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.</param>
 /// <param name="checkpointManager">The manager responsible for checkpointing</param>
 /// <param name="leaseManager">The manager responsible for leasing</param>
 /// <param name="logger">The logger used to write debugging and diagnostics information</param>
 /// <param name="metricFactory">A factory used to create metrics</param>
 /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace to connect to. This is likely to be similar to {yournamespace}.servicebus.windows.net.</param>
 /// <param name="eventHubName">The name of the specific Event Hub to associate the processor with.</param>
 /// <param name="consumerGroupName">The name of the consumer group the processor is associated with. Events are read in the context of this group.</param>
 /// <param name="options">The set of options to use for the processor.</param>
 /// <param name="processorFactory">A factory used to create processors, null for default</param>
 public FixedBatchProcessorClient(ILogger logger, IMetricFactory metricFactory, TokenCredential credential, string fullyQualifiedNamespace, string eventHubName, string consumerGroupName, FixedProcessorClientOptions options, ILeaseManager leaseManager, ICheckpointManager checkpointManager, ProcessorFactory processorFactory = null) : base(logger, metricFactory, credential, fullyQualifiedNamespace, eventHubName, consumerGroupName, options, leaseManager, checkpointManager)
 {
     _logger           = logger;
     _processorFactory = processorFactory ?? new ProcessorFactory((ILogger logger, IMetricFactory metricFactory, ProcessorPartitionContext partitionContext) => (IProcessor)Activator.CreateInstance(typeof(T)));
 }
 /// <summary>
 /// Initializes a new instance of the type
 /// </summary>
 /// <param name="checkpointManager">The manager responsible for checkpointing</param>
 /// <param name="leaseManager">The manager responsible for leasing</param>
 /// <param name="logger">The logger used to write debugging and diagnostics information</param>
 /// <param name="metricFactory">A factory used to create metrics</param>
 /// <param name="connectionString">The connection string to use for connecting to the Event Hubs namespace; it is expected that the Event Hub name and the shared key properties are contained in this connection string.</param>
 /// <param name="consumerGroupName">The name of the consumer group the processor is associated with. Events are read in the context of this group.</param>
 /// <param name="options">The set of options to use for the processor.</param>
 /// <param name="processorFactory">A factory used to create processors, null for default</param>
 public FixedBatchProcessorClient(ILogger logger, IMetricFactory metricFactory, string connectionString, string consumerGroupName, FixedProcessorClientOptions options, ILeaseManager leaseManager, ICheckpointManager checkpointManager, ProcessorFactory processorFactory = null) : base(logger, metricFactory, connectionString, consumerGroupName, options, leaseManager, checkpointManager)
 {
     _logger           = logger;
     _processorFactory = processorFactory ?? new ProcessorFactory((ILogger logger, IMetricFactory metricFactory, ProcessorPartitionContext partitionContext) => (IProcessor)Activator.CreateInstance(typeof(T)));
 }
 /// <summary>
 /// Initializes a new instance of the type
 /// </summary>
 /// <param name="credential">The Azure managed identity credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.</param>
 /// <param name="checkpointManager">The manager responsible for checkpointing</param>
 /// <param name="leaseManager">The manager responsible for leasing</param>
 /// <param name="logger">The logger used to write debugging and diagnostics information</param>
 /// <param name="metricFactory">A factory used to create metrics</param>
 /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace to connect to. This is likely to be similar to {yournamespace}.servicebus.windows.net.</param>
 /// <param name="eventHubName">The name of the specific Event Hub to associate the processor with.</param>
 /// <param name="consumerGroupName">The name of the consumer group the processor is associated with. Events are read in the context of this group.</param>
 /// <param name="options">The set of options to use for the processor.</param>
 protected FixedProcessorClient(ILogger logger, IMetricFactory metricFactory, TokenCredential credential, string fullyQualifiedNamespace, string eventHubName, string consumerGroupName, FixedProcessorClientOptions options, ILeaseManager leaseManager, ICheckpointManager checkpointManager) : base(options?.BatchSize ?? 1, consumerGroupName, fullyQualifiedNamespace, eventHubName, credential, options)
 {
     ConfigureInstance(logger, metricFactory, options, leaseManager, checkpointManager);
 }
 /// <summary>
 /// Initializes a new instance of the type
 /// </summary>
 /// <param name="connectionString">The connection string to use for connecting to the Event Hubs namespace; it is expected that the shared key property is contained in this connection string, but not the Event Hub name.</param>
 /// <param name="checkpointManager">The manager responsible for checkpointing</param>
 /// <param name="leaseManager">The manager responsible for leasing</param>
 /// <param name="logger">The logger used to write debugging and diagnostics information</param>
 /// <param name="metricFactory">A factory used to create metrics</param>
 /// <param name="eventHubName">The name of the specific Event Hub to associate the processor with.</param>
 /// <param name="consumerGroupName">The name of the consumer group the processor is associated with. Events are read in the context of this group.</param>
 /// <param name="options">The set of options to use for the processor.</param>
 protected FixedProcessorClient(ILogger logger, IMetricFactory metricFactory, string connectionString, string eventHubName, string consumerGroupName, FixedProcessorClientOptions options, ILeaseManager leaseManager, ICheckpointManager checkpointManager) : base(options?.BatchSize ?? 1, consumerGroupName, connectionString, eventHubName, options)
 {
     ConfigureInstance(logger, metricFactory, options, leaseManager, checkpointManager);
 }