TaskHandler typedef
TaskHandler =
FutureOr<void> Function(Task task, TaskContext context)
A handler processes one task type. Throwing signals failure, which triggers a retry (up to the envelope's maxRetries); returning normally marks it done.
context carries what the worker knows about this particular run: the
task's stable id to deduplicate on, which attempt this is, and whether it is
the last one. Handlers that don't need any of it can ignore the parameter.
Implementation
typedef TaskHandler = FutureOr<void> Function(Task task, TaskContext context);