QueueManager class
Queue manager that handles job dispatch and processing
Constructors
- QueueManager(ConfigInterface _config, {QueueDriver? driver, String? driverName, IQueueDriverRegistry? registry, QueueConfigLoader? configLoader})
Properties
- configLoader → QueueConfigLoader
-
Gets the config loader.
no setter
- defaultDriverName → String
-
Gets the name of the default driver.
no setter
- driver → QueueDriver
-
Gets the default queue driver.
no setter
-
driverNames
→ List<
String> -
Gets all registered driver names.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- registry → IQueueDriverRegistry
-
Gets the driver registry.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispatch(
QueueJob job, {Duration? delay}) → Future< void> - Dispatches a job to the queue with optional delay. This is the main method - just dispatch any job without registration!
-
dispatchBatch(
List< QueueJob> jobs, {Duration? delay}) → Future<void> - Convenient method to dispatch multiple jobs at once.
-
getDriver(
[String? name]) → QueueDriver - Gets a specific queue driver instance.
-
getMetrics(
) → Map< String, dynamic> ? - Gets current queue metrics. Returns metrics from the driver if it supports metrics tracking.
-
hasDriver(
String name) → bool - Checks if a driver is registered.
-
loadFromConfig(
) → void - Loads queue configuration from the application's config.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
process(
) → Future< void> - Processes jobs from the queue.
-
registerDriver(
String name, QueueDriver driver) → void - Registers a queue driver with the given name.
-
setDefaultDriver(
String name) → void - Sets the default queue driver.
-
startWorker(
{int? maxJobs, Duration delay = const Duration(seconds: 1), Duration? timeout, bool runInBackground = false, void onError(dynamic error, StackTrace stack)?, void onJobStart(QueueJob job)?, void onJobComplete(QueueJob job, dynamic result)?, void onJobError(QueueJob job, dynamic error, StackTrace stack)?}) → Future< void> - Starts a queue worker with the specified configuration.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited