/// <inheritdoc /> public async Task <bool> InitializeAsync(FixedProcessorClient client, FixedProcessorClientOptions options, CancellationToken cancellationToken) { Guard.NotNull(nameof(client), client); Guard.NotNull(nameof(options), options); _options = options; _client = client; var acquiredLock = false; try { await _collectionControl.WaitAsync(cancellationToken).ConfigureAwait(false); acquiredLock = true; var managerCount = _managerCount; await _partitionManager.InitializeAsync(managerCount).ConfigureAwait(false); PopulateCollectionInternal(); } finally { if (acquiredLock) { _collectionControl.Release(); } } return(true); }
/// <inheritdoc /> public async Task <bool> InitializeAsync(FixedProcessorClient client, FixedProcessorClientOptions options, ILogger logger, IMetricFactory metricFactory, CancellationToken cancellationToken) { var success = false; using (Logger.BeginScope("Initialize poison message store")) { Logger.LogDebug("Initializing poison message store"); // Use the same prefix as the checkpoint store if it exists to reduce user configuration requirements _messageStorePrefix = string.IsNullOrWhiteSpace(options.CheckpointPrefix) ? string.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}", client.FullyQualifiedNamespace.ToLowerInvariant(), client.EventHubName.ToLowerInvariant(), client.ConsumerGroup.Replace("$", "").ToLowerInvariant()) : string.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}/{3}", options.CheckpointPrefix, client.FullyQualifiedNamespace.ToLowerInvariant(), client.EventHubName.ToLowerInvariant(), client.ConsumerGroup.Replace("$", "").ToLowerInvariant()); Logger.LogInformation("Store prefix {location}", _messageStorePrefix); _blobNameFormatString = string.Concat(_messageStorePrefix, "/{0}"); success = await CreateStoreIfNotExistsAsync(client, options, cancellationToken).ConfigureAwait(false); } return(success); }
/// <inheritdoc /> public virtual async Task <bool> CreateStoreIfNotExistsAsync(FixedProcessorClientOptions options, CancellationToken cancellationToken) { var success = false; using (Logger.BeginScope("Creating store")) { try { Logger.LogInformation("Creating checkpoint store"); await Client.CreateIfNotExistsAsync().ConfigureAwait(false); success = true; Logger.LogDebug("Completed store creation"); } catch (Exception e) { Logger.LogError(e, "Error creating checkpoint store"); } } return(success); }
/// <inheritdoc /> public virtual async Task <bool> InitializeAsync(FixedProcessorClient client, FixedProcessorClientOptions options, CancellationToken cancellationToken) { var success = false; using (Logger.BeginScope("Initialize checkpoint store")) { Logger.LogDebug("Initializing checkpoint store"); _checkpointPrefix = string.IsNullOrWhiteSpace(options.CheckpointPrefix) ? string.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}", client.FullyQualifiedNamespace.ToLowerInvariant(), client.EventHubName.ToLowerInvariant(), client.ConsumerGroup.Replace("$", "").ToLowerInvariant()) : string.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}/{3}", options.CheckpointPrefix, client.FullyQualifiedNamespace.ToLowerInvariant(), client.EventHubName.ToLowerInvariant(), client.ConsumerGroup.Replace("$", "").ToLowerInvariant()); Logger.LogInformation("Store prefix {location}", _checkpointPrefix); _blobNameFormatString = string.Concat(_checkpointPrefix, "/{0}"); _processorClient = client; success = await CreateStoreIfNotExistsAsync(options, cancellationToken).ConfigureAwait(false); } return(success); }
/// <inheritdoc /> public Task <bool> InitializeAsync(FixedProcessorClient client, FixedProcessorClientOptions options, ILogger logger, IMetricFactory metricFactory, CancellationToken cancellationToken) { return(Task.FromResult(true)); }
/// <inheritdoc /> public Task <bool> CreateStoreIfNotExistsAsync(FixedProcessorClient client, FixedProcessorClientOptions options, CancellationToken cancellationToken) { return(Task.FromResult(true)); }