-
Notifications
You must be signed in to change notification settings - Fork 44
feature: Add option to configure custom azure servicebus processor options #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,11 @@ public AzureServiceBusFeature(IModule module) : base(module) | |
| /// </summary> | ||
| public Action<AzureServiceBusOptions> AzureServiceBusOptions { get; set; } = _ => { }; | ||
|
|
||
| /// <summary> | ||
| /// A delegate to create a <see cref="AzureServiceBusOptions"/> instance. | ||
| /// </summary> | ||
| public Func<IServiceProvider, ServiceBusProcessorOptions> ProcessorOptionsFactory { get; set; } = _ => new ServiceBusProcessorOptions(); | ||
|
|
||
| /// <summary> | ||
| /// A delegate to create a <see cref="ServiceBusAdministrationClient"/> instance. | ||
| /// </summary> | ||
|
|
@@ -68,6 +73,7 @@ public override void Apply() | |
| Services | ||
| .AddSingleton(ServiceBusAdministrationClientFactory) | ||
| .AddSingleton(ServiceBusClientFactory) | ||
| .AddSingleton(ProcessorOptionsFactory) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/modules/servicebus/Elsa.ServiceBus.AzureServiceBus/Features/AzureServiceBusFeature.cs
Line: 76
Comment:
**Singleton `ServiceBusProcessorOptions` shared across all workers**
`ProcessorOptionsFactory` is registered as a singleton, so every `Worker` instance — across all queues and topics — receives the exact same `ServiceBusProcessorOptions` object. If a user needs different concurrency, prefetch, or timeout settings per queue/topic, this design prevents it. Consider documenting this limitation or changing the approach (e.g., a `Func<string, string?, ServiceBusProcessorOptions>` keyed by queue/subscription).
How can I resolve this? If you propose a fix, please make it concise. |
||
| .AddSingleton<ConfigurationQueueTopicAndSubscriptionProvider>() | ||
| .AddSingleton<IWorkerManager, WorkerManager>() | ||
| .AddScoped<IServiceBusInitializer, ServiceBusInitializer>(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The summary says "A delegate to create a
<see cref="AzureServiceBusOptions"/>instance" but the property creates aServiceBusProcessorOptionsinstance, not anAzureServiceBusOptions.Prompt To Fix With AI