Skip to content

Improve fluent API with builder pattern when registering Azure Service Bus message pump  #152

@tomkerkhove

Description

@tomkerkhove

Is your feature request related to a problem? Please describe.
Improve fluent API with builder pattern so that we control what the following methods are that can be called.

services.AddServiceBusQueueMessagePump(secretName, options => options.JobId = jobId)
            .WithServiceBusMessageHandler<OrdersAzureServiceBusMessageHandler, Order>();
services.WithAutoRestartServiceBusQueueMessagePumpOnRotatedCredentials(...);

This is to make it more clear and less verbose since every extension we have today is returning IServiceCollection.

This also helps new people to explore what the other options are for configuring the runtime.

Describe the solution you'd like
Return a IServiceBusMessagePumpBuilder which enforces you to call WithServiceBusMessageHandler, WithAutoRestartOnRotatedCredentials and/or ... after AddServiceBusQueueMessagePump

services.AddServiceBusQueueMessagePump(secretName, options => options.JobId = jobId)
+++     .WithAutoRestartOnRotatedCredentials(...)
        .WithServiceBusMessageHandler<OrdersAzureServiceBusMessageHandler, Order>();
--- services.WithServiceBusMessageHandler<OrdersAzureServiceBusMessageHandler, Order>(); <-- No longer possible on services directly
--- services.WithAutoRestartServiceBusQueueMessagePumpOnRotatedCredentials(...); <-- No longer possible on services directly

What I would not do, however, is have a Build method at the end.

Describe alternatives you've considered
Nothing specifically, but open to suggestions.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalAll current proposals

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions