[Feature Request]: Evolve IDistributionStrategy Interface for Enhanced Flexibility
filipeesch opened this issue · 0 comments
Is your request related to a problem you have?
The current IDistributionStrategy
interface limits the framework and client applications in terms of creating custom distribution strategies. The GetWorkerAsync()
method requires more context to make effective worker selection decisions.
Describe the solution you'd like
We propose the following changes to the interface:
-
Rename the Interface: Change the name of the interface from
IDistributionStrategy
toIWorkerDistributionStrategy
for more clarity. -
Enhance
GetWorkerAsync()
Method: Modify the method to accept aWorkerDistributionStrategyContext
object that provides comprehensive details necessary for electing a worker to process the message. The context object should encompass:- Topic Name
- Consumer Name
- Partition
- Raw Message Key
public interface IWorkerDistributionStrategy
{
void Init(IReadOnlyList<IWorker> workers);
ValueTask<IWorker> GetWorkerAsync(WorkerDistributionStrategyContext context);
}
Are you able to help bring it to life and contribute with a Pull Request?
No
Additional context
By implementing these changes, we aim to grant both the framework and client applications more versatility in devising custom distribution strategies tailored to their specific needs.