RateLimitEvent class abstract

Base class for all rate limit events in JetLeaf.

Rate limit events capture occurrences related to the enforcement of rate limiting on resources, APIs, or operations. These events are dispatched through the JetLeaf application event system and allow developers to observe, monitor, and react to rate limit activity.

This base class is extended by specific event types such as:

Purpose

The purpose of this class is to provide a structured representation of rate limit activity. Each event carries metadata about:

  1. The entity being rate-limited (source),
  2. The rate-limited resource or bucket (limitName),
  3. The timestamp of the event (timestamp), which defaults to the creation time if not explicitly set.

Observers can subscribe to these events to implement:

  • Custom logging of allowed and blocked requests
  • Real-time monitoring dashboards
  • Alerts for excessive request patterns
  • Metrics aggregation for reporting

Properties

  • limitName: The name of the rate-limited resource, such as "login_attempts" or "api_requests".
  • source: The identifier for the entity being rate-limited. Typically this is a user ID, API key, or IP address.
  • timestamp: Optional event timestamp. Defaults to the current time if not specified.

Example

final event = RateLimitAllowedEvent('user:42', 'login_attempts');
eventPublisher.publish(event);

final blockedEvent = RateLimitDeniedEvent('user:42', 'login_attempts');
eventPublisher.publish(blockedEvent);

By extending RateLimitEvent, developers can create custom events with additional metadata or behavior for specialized monitoring or alerting requirements.

Implementers

Constructors

RateLimitEvent(Object source, String limitName, [DateTime? timestamp])
Creates a new rate limit event.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
limitName String
The name of the rate-limited resource or bucket.
final
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, and toString.
inherited
getPackageName() String
Represents an abstraction for identifying the package that an object, resource, or service belongs to.
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