QueueJobRegistry class

Registry for queue job types to enable deserialization

Since jobs are serialized when pushed to persistent queues (file, Redis, etc.), we need a way to reconstruct them when they're pulled from the queue.

Usage:

// Register your job types at application startup
QueueJobRegistry.register('SendEmailJob', (json) => SendEmailJob.fromJson(json));
QueueJobRegistry.register('ProcessPaymentJob', (json) => ProcessPaymentJob.fromJson(json));

// Jobs can now be automatically reconstructed from storage

Constructors

QueueJobRegistry()
factory

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

count int
Get the number of registered job types
no setter

Static Methods

clear() → void
Clear all registered job types (useful for testing)
create(String jobType, Map<String, dynamic> json) QueueJob
Create a job instance from its type name and JSON data
getRegisteredTypes() List<String>
Get all registered job types
isRegistered(String jobType) bool
Check if a job type is registered
register(String jobType, JobFactory factory) → void
Register a job type with its factory function
registerAll(Map<String, JobFactory> factories) → void
Register multiple job types at once