AvailabilityEvent<Available extends AvailabilityState> class
Represents an application-level event that conveys a change or report regarding an application's availability state.
An AvailabilityEvent is emitted to signal transitions or updates in either:
- Readiness (via ReadinessState), or
- Liveness (via LivenessState),
depending on the generic type parameter.
This event integrates into the broader application event pipeline by extending ApplicationEvent, allowing monitoring subsystems, lifecycle managers, or orchestration layers to react to real-time availability changes.
Generic Parameter
The generic type Available specifies the particular availability
enum being reported.
Must extend:
AvailabilityState
Example
final event = AvailabilityEvent(
this,
ReadinessState.ACCEPTING_TRAFFIC,
DateTime.now(),
);
- Inheritance
-
- Object
- EventObject
- ApplicationEvent
- AvailabilityEvent
- Annotations
-
- @Generic(AvailabilityEvent)
Constructors
- AvailabilityEvent(Object source, Available availability, DateTime? timestamp)
-
Creates a new AvailabilityEvent with the given
source,availability, and explicittimestamp.const - AvailabilityEvent.withClock(Object source, Available availability, DateTime? clock)
- Creates a new AvailabilityEvent using an injected or default clock.
Properties
- availability → Available
-
The concrete availability state being reported.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
equalizedProperties(
) → List< Object?> -
Mixin-style contract for value-based equality,
hashCode, andtoString.inherited -
getPackageName(
) → String -
Represents an abstraction for identifying the package that an object,
resource, or service belongs to.
override
-
getSource(
) → Object -
Returns the source of the event.
inherited
-
getTimestamp(
) → DateTime -
Returns the timestamp of the event.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
toStringOptions(
) → ToStringOptions -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
justPublish<
S extends AvailabilityState> (ApplicationEventBus eventBus, Object source, S state) → Future< void> -
Publishes an availability event directly to the provided
eventBus. -
publish<
S extends AvailabilityState> (ConfigurableApplicationContext context, S state) → Future< void> - Publishes an availability state event into the application's event bus.