FutureCallManager class

The FutureCallManager is responsible for managing and executing FutureCalls in the Serverpod framework. A FutureCall is a task that is scheduled to run at a specific time in the future. These tasks are persistent, meaning they are stored in the database and will still execute even if the server is restarted.

Key responsibilities of the FutureCallManager:

  • Scheduling future calls with optional arguments.
  • Cancelling scheduled future calls.
  • Registering future call handlers.
  • Monitoring and executing overdue future calls.

Constructors

FutureCallManager(FutureCallConfig _config, SerializationManager _serializationManager, {required FutureCallDiagnosticsService diagnosticsService, required Session internalSession, required FutureCallSessionBuilder sessionProvider, required InitializeFutureCall initializeFutureCall})
Creates a new FutureCallManager. Typically, this is instantiated internally by the Serverpod.

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

cancelFutureCall(String identifier) Future<void>
Cancels a FutureCall with the specified identifier. If no future call with the given identifier exists, this method has no effect.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerFutureCall(FutureCall<SerializableModel> futureCall, String name) → void
Registers a FutureCall with the manager. This associates a FutureCall implementation with a specific name.
runScheduledFutureCalls() Future<void>
Executes all scheduled future calls that are past their due date. This method scans the database for overdue tasks and processes them.
scheduleFutureCall(String name, SerializableModel? object, DateTime time, String serverId, String? identifier) Future<void>
Schedules a FutureCall by its name. The call will execute at or after the specified time. Optionally, a SerializableModel can be passed as an argument to the call.
start() → void
Starts the FutureCallManager, enabling it to monitor the database for overdue future calls and execute them automatically.
stop({bool unregisterAll = false}) Future<void>
Stops the FutureCallManager, preventing it from monitoring and executing overdue future calls.
toString() String
A string representation of this object.
inherited

Operators

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