$typeCode
$typeCode : string
队列编码(注册表锚点,处理器据此读取界面配置)
队列任务抽象基类
职责:抽象「重试/超时/记账」三类样板——构造时从队列注册表动态应用重试策略 (tries/backoff/timeout/queue,界面可调代码零感知);handle() 为 final 模板方法, 统一推进执行台账(处理中 → 成功/单次失败),业务只需实现 execute() 返回结果数组, 抛异常即本次尝试失败(未耗尽重试交 Laravel 退避重投,耗尽落 td_sys_job_failed)。
崩溃兜底:worker 被杀/超时时本类无机会收尾——QueueLogSubscriber 的 JobProcessing 事件在下一次领取时补记「异常中断」并闭合上次尝试(与 markProcessing 幂等协作)。
┌────────────────── 分区导航(按此顺序阅读)──────────────────┐ 分区 1 · 任务属性 afterCommit / 构造注入与策略应用 分区 2 · 执行模板 handle(final) / execute(抽象) └────────────────────────────────────────────────────────────┘
$typeCode : string
队列编码(注册表锚点,处理器据此读取界面配置)
$data : array
载荷内容(schema 校验后的业务数据,执行台账全量快照)。 命名 $data 而非 $payload:InteractsWithQueue 以 __get('payload') 读取队列原始载荷 (attempts() 依赖它),同名属性会遮蔽魔术方法导致重试计数恒为 1——命名冲突不可犯。
$logId : int
执行台账行 id(状态推进锚点)
__construct(string $typeCode, array $payload, int $logId) : mixed
构造:从注册表动态应用重试策略——tries/backoff/timeout/queue 全部界面配置; afterCommit 在此赋值(Queueable 声明同属性默认 false,类内重复声明被 PHP 判为 不兼容——事务提交后投递统一规避 after_commit=false 的抢跑竞态,业务方零感知)。
| string | $typeCode | |
| array | $payload | |
| int | $logId |
队列未登记