io.quarkus.load.shedding.RequestPrioritizer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-load-shedding Show documentation
Show all versions of quarkus-load-shedding Show documentation
Shed excess load and keep your service available
package io.quarkus.load.shedding;
/**
* Assigns a {@linkplain RequestPriority priority} to a request. All prioritizers
* are inspected and the first one that returns {@code true} for {@link #appliesTo(Object)}
* is taken.
*
* If no prioritizer applies to a given request, the priority of {@link RequestPriority#NORMAL}
* is assumed. By default, a prioritizer for non-application endpoints is present, which
* assigns them the {@link RequestPriority#CRITICAL} priority.
*
* An implementation must be a CDI bean, otherwise it is ignored. CDI typesafe resolution
* rules must be followed. That is, if multiple implementations are provided with different
* {@link jakarta.annotation.Priority} values, only the implementations with the highest
* priority are retained.
*
* @param type of the request
*/
public interface RequestPrioritizer {
boolean appliesTo(Object request);
RequestPriority priority(R request);
}