pyrowman/pheanstalk-bundle
Composer 安装命令:
composer require pyrowman/pheanstalk-bundle
包简介
The PheanstalkBundle is a Symfony2 Bundle that provides a command line interface for manage the evqueue workqueue server & a pheanstalk integration.
README 文档
README
EvQueue workqueue clients for Symfony3.
The Pyrowman\PheanstalkBundle is a fork from LeezyPheanstalkBundle
The Pyrowman\PheanstalkBundle is a Symfony3 Bundle that provides a pheanstalk integration with the following features:
- Command Line Interface for manage the queues.
- An integration to the Symfony3 event system.
- An integration to the Symfony3 profiler system to monitor your evqueue server.
- An integration to the Symfony3 logger system.
- A proxy system to customize the command features.
- Auto-wiring:
PheanstalkInterface
Documentation :
Usage example
<?php namespace Acme\DemoBundle\Controller; use Pheanstalk\Structure\Schedule; use Pheanstalk\Structure\TimeSchedule; use Pyrowman\PheanstalkBundle\Proxy\PheanstalkProxy; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\DependencyInjection\ContainerInterface; class HomeController extends AbstractController { public function indexAction() { $sc = $this->get('service_container'); /** @var PheanstalkProxy $pheanstalk */ $pheanstalk = $sc->get("pheanstalk"); // Create a simple Worflow with one task inside $workflow = $pheanstalk->createTask('Sleep', 'Test', '/bin/sleep 80'); // Put the job into instance execution $pheanstalk->put($workflow); // ---------------------------------------- // check server availability $pheanstalk->getConnection()->isServiceListening(); // true or false //----------------------------------------- // Add a scheduler for the job (by default in continous) $schedule = new Schedule($workflow->getId(), new TimeSchedule()); $workflowSchedule = $pheanstalk->createSchedule($schedule); //----------------------------------------- // Edit a workflow $workflow->setGroup('2nd test group'); $pheanstalk->update($workflow); //----------------------------------------- // Getting infos on the execution of a workflow $workflowInstances = $pheanstalk->getWorkflowInstances($workflow); //----------------------------------------- // Delete a job if ($workflow = $pheanstalk->workflowExists('Sleep')) $pheanstalk->delete($workflow); } public static function getSubscribedServices() { return array_merge(parent::getSubscribedServices(), [ // ... 'service_container' => ContainerInterface::class, ]); } } ?>
Testing
# ensure you have Composer set up $ wget http://getcomposer.org/composer.phar $ php composer.phar install $ bin/phpunit PHPUnit 7.1.2 by Sebastian Bergmann and contributors. .......................................................... 58 / 58 (100%) Time: 11.36 seconds, Memory: 16.00 MB OK (58 tests, 98 assertions) Generating code coverage report in HTML format ... done
License
This bundle is under the MIT license. See the complete license.
Credits
Author - Valentin Corre
Original library Author - Thomas Tourlourat
Contributor :
- Peter Kruithof : Version 3
- Maxwell2022 : Symfony2 Profiler integration
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-03