cakedc/queue-monitor
Composer 安装命令:
composer require cakedc/queue-monitor
包简介
CakeDC Queue Monitor plugin for CakePHP
README 文档
README
Versions and branches
| CakePHP | CakeDC Queue Monitor Plugin | Tag | Notes |
|---|---|---|---|
| ^5.0 | 2.1.0 | 2.next-cake5 | stable |
| ^4.4 | 1.0.0 | 1.next-cake4 | stable |
Overview
The CakeDC Queue Monitor Plugin adds the ability to monitor jobs in queues that are handled by the CakePHP Queue Plugin. This plugin checks the duration of work of individual Jobs and sends a notification when this time is exceeded by a configurable value.
Requirements
- CakePHP 5.0
- PHP 8.1+
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer package is:
composer require cakedc/queue-monitor
Configuration
Add QueueMonitorPlugin to your application by running command:
bin/cake plugin load CakeDC/QueueMonitor
Run the required migrations
bin/cake migrations migrate -p CakeDC/QueueMonitor
Set up the QueueMonitor configuration in your config/app_local.php:
// ... 'QueueMonitor' => [ // With this setting you can enable or disable the queue monitoring, the queue // monitoring is enabled by default 'disable' => false, // mailer config, the default is `default` mailer, you can ommit // this setting if you use default value 'mailerConfig' => 'default', // the default is 30 minutes, you can ommit this setting if you use the default value 'longJobInMinutes' => 30, // the default is 7 days, you can ommit this setting if you use the default value // its advised to set this value correctly after queue usage analysis to avoid // high space usage in db 'purgeLogsOlderThanDays' => 7, // comma separated list of recipients of notification about long running queue jobs 'notificationRecipients' => 'recipient1@yourdomain.com,recipient2@yourdomain.com,recipient3@yourdomain.com', ], // ...
For each queue configuration add listener setting
// ... 'Queue' => [ 'default' => [ // ... 'listener' => \CakeDC\QueueMonitor\Listener\QueueMonitorListener::class, // ... ] ], // ...
Notification command
To set up notifications when there are jobs running for a long time or jobs that may be stuck and blocking the queue please use command:
bin/cake queue-monitor notify
This command will send notification emails to recipients specified in QueueMonitor.notificationRecipients. Best is
to use it as a cronjob.
Test Enqueue command
To quickly test if all queues are running correctly please run this command (replace your-email@domain.com with working
email address:
bin/cake queue-monitor test-enqueue your-email@domain.com
This command will send the command through all configured queues.
Purge queues command
To purge the content of a specified queue you can use the purge queue command:
bin/cake queue-monitor purge-queue your-queue-name
The above command will remove all pending queue jobs from the specified queue.
To purge all queues you can use command:
bin/cake queue-monitor purge-queue --all
Purge Logs command
The logs table may grow overtime, to keep it slim you can use the purge command:
bin/cake queue-monitor purge-logs
This command will purge logs older than value specified in QueueMonitor.purgeLogsOlderThanDays, the value is in
days, the default is 30 days. Best is to use it as a cronjob
Important
Make sure your Job classes have a property value of maxAttempts because if it's missing, the log table can quickly grow to gigantic size in the event of an uncaught exception in Job, Job is re-queued indefinitely in such a case.
cakedc/queue-monitor 适用场景与选型建议
cakedc/queue-monitor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.62k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「queue」 「cakephp」 「queue monitor」 「queue monitoring」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cakedc/queue-monitor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cakedc/queue-monitor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cakedc/queue-monitor 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
Symfony bundle to monitor and execute commands
Collections of statsd collectors with templated metric names
PHP AMQP Binding Library
A Laravel package to monitor queue jobs.
Email Toolkit Plugin for CakePHP
统计信息
- 总下载量: 16.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-22