Skip to content
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

Use single service to provide FetchAndLockRequest #43

Closed
TechnoBerry opened this issue Nov 3, 2021 · 0 comments · Fixed by #45
Closed

Use single service to provide FetchAndLockRequest #43

TechnoBerry opened this issue Nov 3, 2021 · 0 comments · Fixed by #45
Labels
enhancement New feature or request
Milestone

Comments

@TechnoBerry
Copy link
Owner

TechnoBerry commented Nov 3, 2021

Background and motivation

Currently, 2 dependencies are used in the worker to create an instance of FetchAndLockRequest:

  • IOptions<FetchAndLockOptions> which provides WorkerId, MaxTasks, UsePriority, AsyncResponseTimeout
  • ITopicsProvider which provides set of FetchAndLockRequest.Topic. Existing implementation of this interface is implemented by converting set of HandlerMetadata to set of FetchAndLockRequest.Topic.

These 2 dependencies can be replaced with one that will allow to get an instance of FetchAndLockRequest.

Proposal

Add an interface:

interface IFetchAndLockRequestProvider
{
    FetchAndLockRequrest GetRequest();
}

Add a class:

class WorkerServiceOptions
{
    public string WorkerId { get; }
    public IEnumerable<HandlerDescriptor> HandlerDescriptors { get; }
}

Add to ICamundaWorkerBuilder a method for registering the implementation of a new interface with the following signature:

ICamundaWorkerBuilder AddFetchAndLockRequestProvider(
    Func<WorkerServiceOptions, IServiceProvider, IFetchAndLockRequestProvider> factory
);

Add an implementation of proposed interface that uses the 2 dependencies described earlier and register it in DI. Change code in DefaultCamundaWorker to use new IFetchAndLockRequestProvider.

Mark ITopicsProvider and ICamundaWorkerBuilder.AddTopicsProvider as obsolete

@TechnoBerry TechnoBerry added the enhancement New feature or request label Nov 3, 2021
@TechnoBerry TechnoBerry added this to the 1.0.0 milestone Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant