Skip to content

Commit 99f6c95

Browse files
committed
up to date
Signed-off-by: bota <Bota@dotkernel.com>
2 parents 43daa35 + 62a8157 commit 99f6c95

30 files changed

Lines changed: 222 additions & 148 deletions

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
> [!IMPORTANT]
44
> Dotkernel component used to queue tasks to be processed asynchronously based on [netglue/laminas-messenger](https://github.com/netglue/laminas-messenger)
55
6-
A queue system is a vital component in modern web applications that enables the decoupling of certain tasks from the regular request-response cycle.
6+
A queue system is a vital part in modern web applications that enables the decoupling of certain tasks from the regular request-response cycle.
77

8-
This is especially useful for time-consuming and resource-intensive operations which are thus handled asynchronously by background workers on a separate system.
8+
This is especially useful for time-consuming and resource-intensive operations which are thus handled asynchronously by background workers on a separate system.
99

10-
The greatest benefit is to application responsiveness which allows faster execution, while the heavy lifting is scheduled in the queue based on available resources.
10+
The greatest benefit is to application responsiveness, which allows faster execution, while the heavy lifting is scheduled in the queue based on available resources.
1111

12-
The queue system uses logs to ensure maintainability and implements retry features for reliability and stability.
12+
The queue system uses logs to ensure maintainability and implements retry features for reliability and stability.
1313

1414
![Queue process](https://docs.dotkernel.org/img/queue/schema.png)
1515

1616
## Badges
1717

1818
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/queue)
19-
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/queue/1.0)
19+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/queue/1.0.0)
2020

2121
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/queue)](https://github.com/dotkernel/queue/issues)
2222
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/queue)](https://github.com/dotkernel/queue/network)
@@ -28,10 +28,6 @@ The greatest benefit is to application responsiveness which allows faster execut
2828
[![Qodana](https://github.com/dotkernel/queue/actions/workflows/qodana_code_quality.yml/badge.svg?branch=main)](https://github.com/dotkernel/queue/actions/workflows/qodana_code_quality.yml)
2929
[![PHPStan](https://github.com/dotkernel/queue/actions/workflows/static-analysis.yml/badge.svg?branch=main)](https://github.com/dotkernel/queue/actions/workflows/static-analysis.yml)
3030

31-
## Installation
32-
33-
> Until we have a compiled documentation, read the files from /doc/book/v1 folder
34-
3531
## Documentation
3632

3733
Documentation is available at: https://docs.dotkernel.org/queue-documentation

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@
5555
},
5656
"require-dev": {
5757
"laminas/laminas-coding-standard": "^3.0",
58-
"phpunit/phpunit": "^10.5.45",
59-
"roave/security-advisories": "dev-master",
60-
"swoole/ide-helper": "~5.0.0",
6158
"phpstan/phpstan": "^2.0",
6259
"phpstan/phpstan-doctrine": "^2.0",
63-
"phpstan/phpstan-phpunit": "^2.0"
60+
"phpstan/phpstan-phpunit": "^2.0",
61+
"phpunit/phpunit": "^10.5.45",
62+
"roave/security-advisories": "dev-master",
63+
"swoole/ide-helper": "~5.0.0"
6464
},
6565
"autoload": {
6666
"psr-4": {

config/autoload/local.php.dist

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
declare(strict_types=1);
1111

12-
$baseUrl = 'http://queue.dotkernel.net';
12+
$baseUrl = 'https://queue.dotkernel.net';
1313

1414
$databases = [
1515
'default' => [
@@ -43,13 +43,13 @@ return [
4343
'protocol' => 'tcp',
4444
'host' => 'localhost',
4545
'port' => '8556',
46-
'eof' => "\n",
46+
'eof' => PHP_EOL,
4747
],
4848
],
4949
//delay time until the message is added back to the queue if an error occurs during processing
5050
'fail-safe' => [
51-
'first_retry' => 3600000, // 1h
52-
'second_retry' => 43200000, // 12h
53-
'third_retry' => 86400000, // 24h
54-
],
51+
'first_retry' => 3600000, // 1h
52+
'second_retry' => 43200000, // 12h
53+
'third_retry' => 86400000, // 24h
54+
],
5555
];

config/autoload/log.local.php.dist

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Dot\Log\Formatter\Json;
46
use Dot\Log\Logger;
57

@@ -9,17 +11,17 @@ return [
911
'queue-log' => [
1012
'writers' => [
1113
'FileWriter' => [
12-
'name' => 'stream',
13-
'level' => \Dot\Log\Logger::ALERT, // this is equal to 1
14+
'name' => 'stream',
15+
'level' => Logger::ALERT,
1416
'options' => [
15-
'stream' => __DIR__ . '/../../log/queue-log.log',
17+
'stream' => __DIR__ . '/../../log/queue-log.log',
1618
'formatter' => [
1719
'name' => Json::class,
1820
],
1921
],
2022
],
2123
],
22-
]
24+
],
2325
],
2426
],
2527
];

config/autoload/swoole.local.php.dist

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
return [
46
'dotkernel-queue-swoole' => [
5-
// Available in Swoole 4.1 and up; enables coroutine support
6-
// for most I/O operations:
7+
// Available in Swoole 4.1 and up; enables coroutine support for most I/O operations:
78
'enable_coroutine' => true,
89

910
// Configure Swoole TCP Server:
@@ -13,17 +14,17 @@ return [
1314
'mode' => SWOOLE_BASE, // SWOOLE_BASE or SWOOLE_PROCESS;
1415
// SWOOLE_BASE is the default
1516
'protocol' => SWOOLE_SOCK_TCP, // SWOOLE_SSL, // SSL-enable the server
16-
'options' => [
17+
'options' => [
1718
// Set the SSL certificate and key paths for SSL support:
1819
//'ssl_cert_file' => 'path/to/ssl.crt',
1920
//'ssl_key_file' => 'path/to/ssl.key',
20-
// Whether or not the HTTP server should use coroutines;
21+
// Whether the HTTP server should use coroutines;
2122
// enabled by default, and generally should not be disabled:
22-
'package_eof' => "\n",
23-
'open_eof_check' => true,
23+
'package_eof' => PHP_EOL,
24+
'open_eof_check' => true,
2425
'open_length_check' => true,
2526

26-
// in order to run swoole as daemon
27+
// to run swoole as a daemon
2728
'daemonize' => true,
2829

2930
// Overwrite the default location of the pid file;

daemon/messenger.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ WorkingDirectory=/home/dotkernel/queue/
1212
ExecStart=/usr/bin/php /home/dotkernel/queue/bin/cli.php messenger:start
1313

1414
[Install]
15-
WantedBy=swoole.service
15+
WantedBy=swoole.service

daemon/swoole.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ WorkingDirectory=/home/dotkernel/queue/
1212
ExecStart=/usr/bin/php /home/dotkernel/queue/bin/cli.php swoole:start
1313

1414
[Install]
15-
WantedBy=multi-user.target
15+
WantedBy=multi-user.target

phpcs.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
<!-- Paths to check -->
1515
<file>config</file>
16+
<file>public</file>
1617
<file>src</file>
1718
<file>test</file>
1819
<exclude-pattern>config/config.php</exclude-pattern>
19-
<exclude-pattern>config/routes.php</exclude-pattern>
2020

2121
<!-- Include all rules from the Laminas Coding Standard -->
2222
<rule ref="LaminasCodingStandard">

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ includes:
44
parameters:
55
level: 5
66
paths:
7+
- config
8+
- public
79
- src
810
- test
911
treatPhpDocTypesAsCertain: false

public/index.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
declare(strict_types=1);
44

5+
use Mezzio\Application;
6+
use Mezzio\MiddlewareFactory;
7+
use Psr\Container\ContainerInterface;
8+
59
// Delegate static file requests back to the PHP built-in webserver
610
if (PHP_SAPI === 'cli-server' && $_SERVER['SCRIPT_FILENAME'] !== __FILE__) {
711
return false;
@@ -14,17 +18,15 @@
1418
* Self-called anonymous function that creates its own scope and keeps the global namespace clean.
1519
*/
1620
(function () {
17-
/** @var \Psr\Container\ContainerInterface $container */
21+
/** @var ContainerInterface $container */
1822
$container = require 'config/container.php';
1923

20-
/** @var \Mezzio\Application $app */
21-
$app = $container->get(\Mezzio\Application::class);
22-
$factory = $container->get(\Mezzio\MiddlewareFactory::class);
24+
/** @var Application $app */
25+
$app = $container->get(Application::class);
26+
$factory = $container->get(MiddlewareFactory::class);
2327

24-
// Execute programmatic/declarative middleware pipeline and routing
25-
// configuration statements
28+
// Execute programmatic/declarative middleware pipeline and routing configuration statements
2629
(require 'config/pipeline.php')($app, $factory, $container);
27-
(require 'config/routes.php')($app, $factory, $container);
2830

2931
$app->run();
3032
})();

0 commit comments

Comments
 (0)