承接 jorisnoo/craft-queue-failure-handler 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jorisnoo/craft-queue-failure-handler

最新稳定版本:0.1.0

Composer 安装命令:

composer require jorisnoo/craft-queue-failure-handler

包简介

Release matching queue jobs after they fail, instead of leaving them in the failed-jobs list. Pairs with webhubworks/craft-flare for reporting.

README 文档

README

A small Craft CMS module that releases matching queue jobs after they fail, instead of leaving them in the failed-jobs list. Pairs with webhubworks/craft-flare so failures are still reported, just not stuck in the queue.

Useful for queue jobs that won't recover on retry — revoked API credentials, deleted remote resources, deactivated accounts, malformed external state.

Requirements

  • PHP 8.2+
  • Craft CMS 5
  • (Optional but recommended) webhubworks/craft-flare for error reporting

Installation

composer require jorisnoo/craft-queue-failure-handler

Register the module in your config/app.php:

return [
    'modules' => [
        'queue-failure-handler' => \Noo\CraftQueueFailureHandler\Module::class,
    ],
    'bootstrap' => ['queue-failure-handler'],
];

Configuration

Create config/queue-failure-handler.php:

<?php

use verbb\formie\jobs\TriggerIntegration;

return [
    'rules' => [
        // Drop Formie Mailchimp jobs whose account has been deactivated.
        [
            'jobClass' => TriggerIntegration::class,
            'message' => '/User Disabled|account has been deactivated/i',
        ],
    ],
];

Each rule is either:

  • A callable fn(\yii\queue\ExecEvent $event): bool — full control, do whatever you want with the event.
  • An array with optional jobClass and message keys. Both must match if both are present.
    • jobClass — fully-qualified class name; matched with instanceof.
    • message — matched against $event->error->getMessage(). Substring by default, regex if it starts with /.

When a rule matches, the queue row is deleted and $event->retry is set to false. Errors that don't match any rule keep Craft's default behaviour (retry until attempts are exhausted, then sit in the failed list).

How It Works

The module listens on craft\queue\Queue::EVENT_AFTER_ERROR. When a rule matches, it calls Craft::$app->getQueue()->release($event->id) to drop the job from the queue table.

It does not report errors itself. If webhubworks/craft-flare is installed, its own listener on the same event handles reporting — the report still lands in Flare even though the queue row is gone.

License

MIT — see LICENSE.md.

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固