-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from CakeDC/feature/cake5-improvements
Feature/cake5 improvements
- Loading branch information
Showing
12 changed files
with
572 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Define the line ending behavior of the different file extensions | ||
# Set default behavior, in case users don't have core.autocrlf set. | ||
* text text=auto eol=lf | ||
|
||
.php diff=php | ||
|
||
# Declare files that will always have CRLF line endings on checkout. | ||
*.bat eol=crlf | ||
|
||
# Declare files that will always have LF line endings on checkout. | ||
*.pem eol=lf | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
*.png binary | ||
*.jpg binary | ||
*.gif binary | ||
*.ico binary | ||
*.mo binary | ||
*.pdf binary | ||
*.phar binary | ||
*.woff binary | ||
*.woff2 binary | ||
*.ttf binary | ||
*.otf binary | ||
*.eot binary | ||
|
||
# Remove files for archives generated using `git archive` | ||
.github export-ignore | ||
.phive export-ignore | ||
contrib export-ignore | ||
tests/test_app export-ignore | ||
tests/TestCase export-ignore | ||
|
||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.mailmap export-ignore | ||
.stickler.yml export-ignore | ||
Makefile export-ignore | ||
phpcs.xml export-ignore | ||
phpstan.neon.dist export-ignore | ||
phpstan-baseline.neon export-ignore | ||
phpunit.xml.dist export-ignore | ||
psalm.xml export-ignore | ||
psalm-baseline.xml export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
## Versions and branches | ||
| CakePHP | CakeDC Queue Monitor Plugin | Tag | Notes | | ||
|:-------:|:--------------------------------------------------------------------------:|:------------:|:-------| | ||
| ^5.0 | [2.0.0](https://github.com/CakeDC/cakephp-queue-monitor/tree/2.next-cake5) | 2.next-cake5 | stable | | ||
| ^5.0 | [2.1.0](https://github.com/CakeDC/cakephp-queue-monitor/tree/2.next-cake5) | 2.next-cake5 | stable | | ||
| ^4.4 | [1.0.0](https://github.com/CakeDC/cakephp-queue-monitor/tree/1.next-cake4) | 1.next-cake4 | stable | | ||
|
||
## Overview | ||
|
@@ -26,28 +26,14 @@ composer require cakedc/queue-monitor | |
``` | ||
|
||
## Configuration | ||
|
||
Add QueueMonitorPlugin to your `Application::bootstrap`: | ||
```php | ||
use Cake\Http\BaseApplication; | ||
use CakeDC\QueueMonitor\QueueMonitorPlugin; | ||
|
||
class Application extends BaseApplication | ||
{ | ||
// ... | ||
|
||
public function bootstrap(): void | ||
{ | ||
parent::bootstrap(); | ||
|
||
$this->addPlugin(QueueMonitorPlugin::class); | ||
} | ||
|
||
// ... | ||
} | ||
|
||
Add QueueMonitorPlugin to your application by running command: | ||
```shell | ||
bin/cake plugin load CakeDC/QueueMonitor | ||
``` | ||
Run the required migrations | ||
```shell | ||
bin/cake migrations migrate -p CakeDC/QueueMonitor | ||
``` | ||
|
||
Set up the QueueMonitor configuration in your `config/app_local.php`: | ||
```php | ||
// ... | ||
|
@@ -58,28 +44,22 @@ Set up the QueueMonitor configuration in your `config/app_local.php`: | |
|
||
// mailer config, the default is `default` mailer, you can ommit | ||
// this setting if you use default value | ||
'mailerConfig' => 'myCustomMailer', | ||
'mailerConfig' => 'default', | ||
|
||
// the default is 30 minutes, you can ommit this setting if you | ||
// use the default value | ||
'longJobInMinutes' => 45, | ||
// the default is 30 minutes, you can ommit this setting if you use the default value | ||
'longJobInMinutes' => 30, | ||
|
||
// the default is 30 days, you can ommit this setting if you | ||
// 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' => 10, | ||
'purgeLogsOlderThanDays' => 7, | ||
|
||
// comma separated list of recipients of notification about long running queue jobs | ||
'notificationRecipients' => '[email protected],[email protected],[email protected]', | ||
], | ||
// ... | ||
``` | ||
|
||
Run the required migrations | ||
```shell | ||
bin/cake migrations migrate -p CakeDC/QueueMonitor | ||
``` | ||
|
||
For each queue configuration add `listener` setting | ||
```php | ||
// ... | ||
|
@@ -95,19 +75,46 @@ For each queue configuration add `listener` setting | |
|
||
## Notification command | ||
|
||
To set up notifications when there are long running or possible stuck jobs please use 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: | ||
```shell | ||
bin/cake queue_monitor notify | ||
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 | ||
to use it as a cronjob. | ||
|
||
## Test Enqueue command | ||
|
||
To quickly test if all queues are running correctly please run this command (replace `[email protected]` with working | ||
email address: | ||
```shell | ||
bin/cake queue-monitor test-enqueue [email protected] | ||
``` | ||
|
||
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: | ||
```shell | ||
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: | ||
|
||
```shell | ||
bin/cake queue-monitor purge-queue --all | ||
|
||
``` | ||
|
||
## Purge command | ||
## Purge Logs command | ||
|
||
The logs table may grow overtime, to keep it slim you can use the purge command: | ||
```shell | ||
bin/cake queue_monitor purge | ||
bin/cake queue-monitor purge-logs | ||
``` | ||
|
||
This command will purge logs older than value specified in `QueueMonitor.purgeLogsOlderThanDays`, the value is in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.