aws / aws/aws-dotnet-messaging

Expose ServiceCollection to MessageBusBuilder.AddAdditionalService

Open
#281 1 comment 0 reactions 0 assignees View on GitHub
feature-request p2 queued
Dominant language
C#
Stars
143
Forks
27
Avg merge
1d 18h
Merged PRs (30d)
4

Description

### Describe the feature

The current implementation of `MessageBusBuilder.AddAdditionalService` allows for services to be added to the underlying `ServiceCollection` but it would be useful if an overload with an action that includes direct access to `MessageConfiguration`/`IServiceCollection` were added.

### Use Case

Access to the underlying service collection and message configuration would greatly improve integration of external extensions eg. transactional outbox pattern

### Proposed Solution

```cs
public class MessageBusBuilder : IMessageBusBuilder
{
...

private readonly IList> _additionalServices = new List>();

public IMessageBusBuilder AddAdditionalService(ServiceDescriptor serviceDescriptor)
{
_additionalServices.Add((_, services) => services.TryAdd(service));
return this;
}

public IMessageBusBuilder AddAdditionalService(Action action)
{
_additionalServices.Add(action);
return this;
}

internal void Build()
{
...
foreach (var action in _additionalServices)
{
action.Invoke(_messageConfiguration, _serviceCollection);
}
}
}
```

### Other Information

_No response_

### Acknowledgements

- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### AWS.Messaging (or related) package versions

AWS.Messaging

### Targeted .NET Platform

all

### Operating System and version

all

Contributor guide

Open the contributing guide

Research direction

Start by locating MessageBusBuilder and reading the existing AddAdditionalService(ServiceDescriptor) overload and its Build path. Confirm how IMessageConfiguration and IServiceCollection are available there, then verify that the proposed overload is invoked during building and supports the stated external-extension use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.