Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Quick configuration policy to mark all endpoints as being durable in one line of code #731

Open
jeremydmiller opened this issue Jun 14, 2022 · 1 comment
Milestone

Comments

@jeremydmiller
Copy link
Member

No description provided.

@jeremydmiller jeremydmiller added this to the 2.0 milestone Sep 9, 2022
@jeremydmiller
Copy link
Member Author

Some notes:

Introduce back some sort of EndpointCollection as a child of JasperRuntime. That would hold the policies.

  • the policies need to be evaluated when endpoints are first created
  • also evaluated when one needs to be created on the fly
public interface IEndpointPolicy
{
    void Apply(Endpoint endpoint, IJasperRuntime runtime);
}

internal class LambdaEndpointPolicy<T> : IEndpointPolicy where T : Endpoint
{
    private readonly Action<T, IJasperRuntime> _configure;

    public LambdaEndpointPolicy(Action<T, IJasperRuntime> configure)
    {
        _configure = configure;
    }

    public void Apply(Endpoint endpoint, IJasperRuntime runtime)
    {
        if (endpoint is T e) _configure(e, runtime);
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant