ApplicationAvailabilityAutoConfiguration class
Provides the default auto-configuration for managing and tracking application availability states—including both liveness and readiness.
This implementation:
- Listens for incoming AvailabilityEvent instances
- Stores the latest event per availability type
- Exposes the current state via ApplicationAvailability APIs
It is automatically registered through the @AutoConfiguration annotation
and is intended to be used by health probes, monitoring endpoints,
orchestration systems, and internal framework components.
How It Works
- Each time an AvailabilityEvent is received, it is stored in an internal map,
keyed by the event’s availability state type (e.g.
LivenessState,ReadinessState). - Consumers then retrieve the current or last-known state through getState, getStateOrDefault, or getLastEvent.
Example
final availability = ApplicationAvailabilityAutoConfiguration();
availability.onApplicationEvent(
AvailabilityEvent(source, ReadinessState.ACCEPTING_TRAFFIC, DateTime.now())
);
final readiness = availability.getReadinessState(); // ACCEPTING_TRAFFIC
- Inheritance
-
- Object
- ApplicationAvailability
- ApplicationAvailabilityAutoConfiguration
- Implemented types
- Annotations
Constructors
- ApplicationAvailabilityAutoConfiguration()
- Provides the default auto-configuration for managing and tracking application availability states—including both liveness and readiness.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getLastEvent<
S extends AvailabilityState> (Class< S> stateType) → AvailabilityEvent<S> ? -
Returns the most recent AvailabilityEvent associated with availability
type
S.override -
getLivenessState(
) → LivenessState -
Returns the application's current liveness state, or a fallback value.
inherited
-
getReadinessState(
) → ReadinessState -
Returns the application's current readiness state, or a fallback value.
inherited
-
getState<
S extends AvailabilityState> (Class< S> stateType) → S? -
Retrieves the most recently known availability state of type
S.override -
getStateOrDefault<
S extends AvailabilityState> (Class< S> stateType, S defaultState) → S -
Retrieves the availability state of type
S, providing a default if needed.inherited -
getStateType(
AvailabilityState state) → Class< AvailabilityState> -
Determines the reflective type (
Class) associated with the given AvailabilityState instance. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onApplicationEvent(
AvailabilityEvent< AvailabilityState> event) → Future<void> -
Handle an application event of type
E.override -
supportsEventOf(
ApplicationEvent event) → bool -
Returns true if the listener supports the given event.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited