WorkerHeartbeat class

Structured payload describing worker state for external monitoring systems.

Constructors

WorkerHeartbeat({required String workerId, required DateTime timestamp, required int isolateCount, required int inflight, required List<QueueHeartbeat> queues, DateTime? lastLeaseRenewal, String version = currentVersion, String namespace = 'stem', Map<String, Object?>? extras})
Captures the current worker state at timestamp using optional extras.
WorkerHeartbeat.fromJson(Map<String, Object?> json)
Rehydrates a WorkerHeartbeat from the JSON json map.
factory

Properties

extras → Map<String, Object?>
Additional metadata for downstream consumers.
final
hashCode → int
The hash code for this object.
no setterinherited
inflight → int
Total number of deliveries currently in-flight for this worker.
final
isolateCount → int
Number of isolates currently active in the worker pool.
final
lastLeaseRenewal → DateTime?
Optional timestamp of the most recent lease renewal across in-flight deliveries.
final
namespace → String
Namespace used for routing (e.g. Redis channel prefix).
final
queues → List<QueueHeartbeat>
Queue level detail for in-flight deliveries.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timestamp → DateTime
Timestamp for when this heartbeat was generated.
final
version → String
Semantic version of the payload structure.
final
workerId → String
Logical worker identifier (typically the consumer/worker name).
final

Methods

encode() → String
Encode the heartbeat as a JSON string for transport.
extrasAs<T>({required Codec<T, Object?> codec}) → T
Decodes the full extras payload as a typed DTO with codec.
extrasJson<T>({required T decode(Map<String, dynamic> payload), String? typeName}) → T
Decodes the full extras payload as a typed DTO with a JSON decoder.
extrasVersionedJson<T>({required int version, required T decode(Map<String, dynamic> payload, int version), int? defaultDecodeVersion, String? typeName}) → T
Decodes the full extras payload as a typed DTO with a version-aware JSON decoder.
extraValue<T>(String key, {Codec<T, Object?>? codec}) → T?
Returns the decoded extras value for key, or null when absent.
extraValueOr<T>(String key, T fallback, {Codec<T, Object?>? codec}) → T
Returns the decoded extras value for key, or fallback when absent.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requiredExtraValue<T>(String key, {Codec<T, Object?>? codec}) → T
Returns the decoded extras value for key, throwing when absent.
toJson() → Map<String, Object?>
Serializes this heartbeat into a JSON-ready map for transport or storage.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

topic(String namespace) → String
Convenience helper producing the Redis topic for the provided namespace.

Constants

currentVersion → const String
Static version identifier for the heartbeat schema.