Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@

- This version is a complete rewrite of SlmQueue. It is now splitted in several modules and support both
Beanstalkd and Amazon SQS queue systems through SlmQueueBeanstalkd and SlmQueueSqs modules.

# 2.0.0

- Complete rewrite to support latest Laminas framework, Pheanstalk and PHPUnit
- Require PHP 7
67 changes: 1 addition & 66 deletions Module.php
Original file line number Diff line number Diff line change
@@ -1,68 +1,3 @@
<?php

namespace SlmQueueBeanstalkd;

use Zend\Loader;
use Zend\Console\Adapter\AdapterInterface;
use Zend\ModuleManager\Feature;

/**
* SlmQueueBeanstalkd
*/
class Module implements
Feature\AutoloaderProviderInterface,
Feature\ConfigProviderInterface,
Feature\ConsoleBannerProviderInterface,
Feature\ConsoleUsageProviderInterface
{
/**
* {@inheritDoc}
*/
public function getAutoloaderConfig()
{
return array(
Loader\AutoloaderFactory::STANDARD_AUTOLOADER => array(
Loader\StandardAutoloader::LOAD_NS => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}

/**
* {@inheritDoc}
*/
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}

/**
* {@inheritDoc}
*/
public function getConsoleBanner(AdapterInterface $console)
{
return 'SlmQueueBeanstalkd';
}

/**
* {@inheritDoc}
*/
public function getConsoleUsage(AdapterInterface $console)
{
return array(
'queue beanstalkd <queue> [--timeout=]' => 'Process jobs with beanstalkd',

array('<queue>', 'Queue\'s name to process'),
array('--timeout=', 'Timeout (in seconds) to wait for a job to arrive')
);
}

/**
* {@inheritDoc}
*/
public function getModuleDependencies()
{
return array('SlmQueue');
}
}
require __DIR__ . '/src/Module.php';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you configure your IDE so each line ends with a return? See the warning GitHub issues here.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Created by Jurian Sluiman and Michaël Gallego

Requirements
------------
* [Zend Framework 2](https://github.com/zendframework/zf2)
* [Laminas MVC Skeleton](https://github.com/laminas/laminas-mvc-skeleton)
* [SlmQueue](https://github.com/juriansluiman/SlmQueue)
* [Pda Pheanstalk](https://github.com/pda/pheanstalk)

Expand All @@ -24,7 +24,7 @@ add the following line into your `composer.json` file:

```json
"require": {
"slm/queue-beanstalkd": "0.4.*"
"slm/queue-beanstalkd": "2.0.*"
}
```

Expand Down
117 changes: 69 additions & 48 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,74 @@
{
"name": "slm/queue-beanstalkd",
"description": "Zend Framework 2 module that integrates with Beanstalkd queuing system",
"license": "BSD-3-Clause",
"type": "library",
"keywords": [
"zf2",
"queue",
"job",
"beanstalk",
"beanstalkd",
"pheanstalk"
],
"homepage": "https://github.com/juriansluiman/SlmQueueBeanstalkd",
"authors": [
{
"name": "Jurian Sluiman",
"email": "[email protected]",
"homepage": "http://juriansluiman.nl"
},
{
"name": "Michaël Gallego",
"email": "[email protected]",
"homepage": "http://www.michaelgallego.fr"
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zend-mvc": "~2.2",
"zendframework/zend-servicemanager": "~2.2",
"zendframework/zend-stdlib": "~2.2",
"slm/queue": "0.4.*",
"pda/pheanstalk": "~3.0"
"name": "slm/queue-Beanstalkd",
"description": "Laminas Framework module that integrates Beanstalkd as queuing system",
"license": "BSD-3-Clause",
"type": "library",
"keywords": [
"laminas",
"mezzio",
"queue",
"job",
"beanstalkd",
"pheanstalk"
],
"homepage": "https://github.com/JouwWeb/SlmQueueBeanstalkd",
"authors": [
{
"name": "Stefan Kleff",
"email": "[email protected]",
"homepage": "http://www.goalio.de"
},
"require-dev": {
"zendframework/zendframework": "~2.2",
"squizlabs/php_codesniffer": "1.5.*",
"phpunit/phpunit": "~4.1"
},
"extra": {
"branch-alias": {
"dev-master": "0.4.x-dev"
}
{
"name": "Bas Kamer",
"email": "[email protected]",
"homepage": "https://bushbaby.nl"
}
],
"require": {
"php": "^7.2",
"laminas/laminas-eventmanager": "^3.2.1",
"laminas/laminas-servicemanager": "^3.3.1",
"laminas/laminas-stdlib": "^3.2",
"slm/queue": "^2.0",
"pda/pheanstalk": "^4.0"
},
"require-dev": {
"laminas/laminas-config": "^2.6 || ^3.0",
"laminas/laminas-modulemanager": "^2.8",
"laminas/laminas-view": "^2.10",
"laminas/laminas-log": "^2.9",
"laminas/laminas-i18n": "^2.6",
"laminas/laminas-serializer": "^2.8",
"laminas/laminas-mvc": "^2.7.13",
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5",
"php-coveralls/php-coveralls": "^2.0"
},
"extra": {
"branch-alias": {
"dev-master": "3.1.x-dev"
},
"autoload": {
"psr-0": {
"SlmQueueBeanstalkd": "src/"
},
"classmap": [
"./Module.php"
]
"laminas": {
"module": "SlmQueueBeanstalkd\\Module",
"config-provider": "SlmQueueBeanstalkd\\ConfigProvider",
"component-whitelist": [
"slm/queue"
]
}
},
"autoload": {
"psr-4": {
"SlmQueueBeanstalkd\\": "src/",
"SlmQueueTest\\": "vendor/slm/queue/tests/"
}
},
"autoload-dev": {
"psr-4": {
"SlmQueueBeanstalkdTest\\": "tests/"
}
},
"scripts": {
"cs-check": "phpcs",
"cs-fix": "phpcbf"
}
}
115 changes: 78 additions & 37 deletions config/module.config.php
Original file line number Diff line number Diff line change
@@ -1,44 +1,85 @@
<?php

return array(
'service_manager' => array(
'factories' => array(
'SlmQueueBeanstalkd\Options\BeanstalkdOptions' => 'SlmQueueBeanstalkd\Factory\BeanstalkdOptionsFactory',
'SlmQueueBeanstalkd\Service\PheanstalkService' => 'SlmQueueBeanstalkd\Factory\PheanstalkFactory',
'SlmQueueBeanstalkd\Worker\BeanstalkdWorker' => 'SlmQueue\Factory\WorkerFactory'
)
),

'controllers' => array(
'factories' => array(
'SlmQueueBeanstalkd\Controller\BeanstalkdWorkerController' => 'SlmQueueBeanstalkd\Factory\BeanstalkdWorkerControllerFactory',
),
),
use SlmQueue\Strategy\MaxRunsStrategy;
use SlmQueueBeanstalkd\Factory\BeanstalkdQueueFactory;
use SlmQueue\Factory\WorkerFactory;
use SlmQueueBeanstalkd\Controller\BeanstalkdWorkerController;
use SlmQueueBeanstalkd\Factory\BeanstalkdWorkerControllerFactory;
use SlmQueueBeanstalkd\Strategy\ClearObjectManagerStrategy;
use SlmQueueBeanstalkd\Worker\BeanstalkdWorker;

'console' => array(
'router' => array(
'routes' => array(
'slm-queue-beanstalked-worker' => array(
return [
'service_manager' => [
'factories' => [
BeanstalkdWorker::class => WorkerFactory::class,
\Pheanstalk::class => \SlmQueueBeanstalkd\Factory\PheanstalkFactory::class
]
],
'controllers' => [
'factories' => [
BeanstalkdWorkerController::class => BeanstalkdWorkerControllerFactory::class,
\Pheanstalk::class => \SlmQueueBeanstalkd\Factory\PheanstalkFactory::class
],
],
'console' => [
'router' => [
'routes' => [
'slm-queue-Beanstalkd-worker' => [
'type' => 'Simple',
'options' => array(
'route' => 'queue beanstalkd <queue> [--timeout=]',
'defaults' => array(
'controller' => 'SlmQueueBeanstalkd\Controller\BeanstalkdWorkerController',
'options' => [
'route' => 'queue Beanstalkd <queue> [--timeout=] --start',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the lower case b. I think that is better, and it is identical to before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the way we use an argument to decide what action we are going to do perform a little bit strange. Let's remodel those to:

  • queue beanstalkd start <queue> [--timeout]
  • queue beanstalkd recover <queue>
  • etc..

'defaults' => [
'controller' => BeanstalkdWorkerController::class,
'action' => 'process'
),
),
),
),
),
),

'slm_queue' => array(
'beanstalkd' => array(
'connection' => array(
'host' => '0.0.0.0',
'port' => 11300,
'timeout' => 2
)
],
],
],
'slm-queue-Beanstalkd-recover' => [
'type' => 'Simple',
'options' => [
'route' => 'queue Beanstalkd <queue> --recover [--executionTime=]',
'defaults' => [
'controller' => BeanstalkdWorkerController::class,
'action' => 'recover'
],
],
],
'slm-queue-Beanstalkd-stats' => [
'type' => 'Simple',
'options' => [
'route' => 'queue Beanstalkd <queue> --stats',
'defaults' => [
'controller' => BeanstalkdWorkerController::class,
'action' => 'stats'
],
],
],
],
],
],
'slm_queue' => [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think everything below this line is some dummy / TODO code, that should now be removed. Right?

'worker_strategies' => [
'default' => [
MaxRunsStrategy::class => ['max_runs' => 1]
]
],
'queues' => [
'my-beanstalkd-queue' => [
'deleted_lifetime' => -1,
'buried_lifetime' => -1,
],
],
'queue_manager' => [
'factories' => [
'mailing' => BeanstalkdQueueFactory::class
]
],
],
'beanstalkd' => array(
'connection' => array(
'host' => '0.0.0.0',
'port' => 11300,
'timeout' => 2
)
)
);
];
Loading