mirror of
https://github.com/bitwarden/server
synced 2026-01-08 19:43:34 +00:00
Add default values for MaxConcurrentCalls and PrefetchCount across event and integration ASB listeners (#6403)
* Add default values for MaxConcurrentCalls and PrefetchCount across all event and integration ASB listeners * Fix test failure
This commit is contained in:
@@ -5,4 +5,6 @@ public interface IEventListenerConfiguration
|
||||
public string EventQueueName { get; }
|
||||
public string EventSubscriptionName { get; }
|
||||
public string EventTopicName { get; }
|
||||
public int EventPrefetchCount { get; }
|
||||
public int EventMaxConcurrentCalls { get; }
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ public interface IIntegrationListenerConfiguration : IEventListenerConfiguration
|
||||
public string IntegrationSubscriptionName { get; }
|
||||
public string IntegrationTopicName { get; }
|
||||
public int MaxRetries { get; }
|
||||
public int IntegrationPrefetchCount { get; }
|
||||
public int IntegrationMaxConcurrentCalls { get; }
|
||||
|
||||
public string RoutingKey
|
||||
{
|
||||
|
||||
@@ -25,4 +25,24 @@ public abstract class ListenerConfiguration
|
||||
{
|
||||
get => _globalSettings.EventLogging.AzureServiceBus.IntegrationTopicName;
|
||||
}
|
||||
|
||||
public int EventPrefetchCount
|
||||
{
|
||||
get => _globalSettings.EventLogging.AzureServiceBus.DefaultPrefetchCount;
|
||||
}
|
||||
|
||||
public int EventMaxConcurrentCalls
|
||||
{
|
||||
get => _globalSettings.EventLogging.AzureServiceBus.DefaultMaxConcurrentCalls;
|
||||
}
|
||||
|
||||
public int IntegrationPrefetchCount
|
||||
{
|
||||
get => _globalSettings.EventLogging.AzureServiceBus.DefaultPrefetchCount;
|
||||
}
|
||||
|
||||
public int IntegrationMaxConcurrentCalls
|
||||
{
|
||||
get => _globalSettings.EventLogging.AzureServiceBus.DefaultMaxConcurrentCalls;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,14 @@ public class AzureServiceBusEventListenerService<TConfiguration> : EventLoggingL
|
||||
TConfiguration configuration,
|
||||
IEventMessageHandler handler,
|
||||
IAzureServiceBusService serviceBusService,
|
||||
ServiceBusProcessorOptions serviceBusOptions,
|
||||
ILoggerFactory loggerFactory)
|
||||
: base(handler, CreateLogger(loggerFactory, configuration))
|
||||
{
|
||||
_processor = serviceBusService.CreateProcessor(
|
||||
topicName: configuration.EventTopicName,
|
||||
subscriptionName: configuration.EventSubscriptionName,
|
||||
new ServiceBusProcessorOptions());
|
||||
options: serviceBusOptions);
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken cancellationToken)
|
||||
|
||||
@@ -18,6 +18,7 @@ public class AzureServiceBusIntegrationListenerService<TConfiguration> : Backgro
|
||||
TConfiguration configuration,
|
||||
IIntegrationHandler handler,
|
||||
IAzureServiceBusService serviceBusService,
|
||||
ServiceBusProcessorOptions serviceBusOptions,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
_handler = handler;
|
||||
@@ -29,7 +30,7 @@ public class AzureServiceBusIntegrationListenerService<TConfiguration> : Backgro
|
||||
_processor = _serviceBusService.CreateProcessor(
|
||||
topicName: configuration.IntegrationTopicName,
|
||||
subscriptionName: configuration.IntegrationSubscriptionName,
|
||||
options: new ServiceBusProcessorOptions());
|
||||
options: serviceBusOptions);
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken cancellationToken)
|
||||
|
||||
@@ -301,6 +301,9 @@ public class GlobalSettings : IGlobalSettings
|
||||
private string _eventTopicName;
|
||||
private string _integrationTopicName;
|
||||
|
||||
public virtual int DefaultMaxConcurrentCalls { get; set; } = 1;
|
||||
public virtual int DefaultPrefetchCount { get; set; } = 0;
|
||||
|
||||
public virtual string EventRepositorySubscriptionName { get; set; } = "events-write-subscription";
|
||||
public virtual string SlackEventSubscriptionName { get; set; } = "events-slack-subscription";
|
||||
public virtual string SlackIntegrationSubscriptionName { get; set; } = "integration-slack-subscription";
|
||||
|
||||
Reference in New Issue
Block a user