Configuring Priority
Apizr could use Fusillade to offer some api priority management on calls.
To be short, Fusillade is about:
- Auto-deduplication of relevant requests
- Request Limiting
- Request Prioritization
- Speculative requests
Please refer to its official documentation if you’d like to know more about it.
Registering
Please first install this integration package:
Project | Current | V-Next |
---|---|---|
Apizr.Integrations.Fusillade |
Then you'll be able to register with this option:
options => options.WithPriorityManagement()
Defining
While defining your api interfaces using Apizr to send a request, you can add an int property param decorated with the provided Property attribute to your methods like:
[WebApi("https://reqres.in/api")]
public interface IReqResService
{
[Get("/users")]
Task<UserList> GetUsersAsync([Priority] int priority);
}
Using
Just call your api with your priority:
var result = await _reqResManager.ExecuteAsync(api => api.GetUsersAsync((int)Priority.Background));