WaitingMessage class
A class that manages messages waiting to be processed in a publish/subscribe system. It handles message state tracking, payload encryption, and lifecycle management. It is not a Locality Event, because Locality Events are only created upon acknowledgment by the server
Each instance represents a single message in the waiting state and provides methods to update its state and payload. The class also maintains static tracking of all waiting messages across the system.
Example usage:
final message = WaitingMessage(pubSubInstance, "user.update", {"userId": 123});
message.setFinalPayload(encryptedData);
// ... after processing ...
message.resolve();
- Inheritance
-
- Object
- ChangeNotifier
- WaitingMessage
Constructors
-
WaitingMessage(String channel, String event, Map<
String, dynamic> payload) - Creates a new waiting message with the specified pub/sub system, event, and payload.
Properties
- channel ↔ String
-
Reference to the pub/sub system handling this message
getter/setter pair
- event ↔ String
-
The event type/name this message is associated with
getter/setter pair
- failed ↔ bool
-
Indicates if the message processing failed
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- id ↔ int
-
Unique identifier for this waiting message
getter/setter pair
-
payload
↔ Map<
String, dynamic> -
Original payload data for the message
getter/setter pair
- resolved ↔ bool
-
Indicates if the message has been successfully processed
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timestamp ↔ int
-
Timestamp when this message was created (in milliseconds since epoch)
getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
getFinalPayload(
) → Map< String, dynamic> - Retrieves the final payload including both original and encrypted data.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resolve(
) → void - Marks the message as resolved and performs cleanup.
-
setFinalPayload(
String cipherPayload) → void - Sets the final payload for the message, including the encrypted data.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
waitingMessageById
↔ Map<
int, WaitingMessage> -
Global map of all waiting messages indexed by their IDs
getter/setter pair
Static Methods
-
getWaitingMessageCount(
) → int - Returns the current count of unresolved waiting messages in the system