承接 splash/tasking-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

splash/tasking-bundle

最新稳定版本:2.0.0

Composer 安装命令:

composer require splash/tasking-bundle

包简介

Advanced Tasking Bundle for Symfony Applications (100% PHP)

README 文档

README

Advanced Tasking Manager for Symfony. 100% Php with high concurrency management.

Key features

  • Background tasking: create jobs to be run by workers (Symfony commands)
  • 100% PHP, works on any Linux Server with PHP7.2+
  • High concurrency management: use jobs token to ensure task is executed by a single process.
  • Multi-server compatible: tokens are stored in a central SQL Table.
  • Optimized memory footprint: create a dedicated Symfony environnement to reduce memory impacts.

Total Downloads Latest Stable Version

Installation

Step 1 - Requirements and Installing the bundle

The first step is to tell composer that you want to download Tasking-Bundle which can be achieved by typing the following at the command prompt:

composer require splash/tasking-bundle

Step 2 - Enable the bundle in your kernel

The bundle must be added to your AppKernel.

**Step usually not necessary in Symfony Flex.

// app/AppKernel.php public function registerBundles() { return array( // ... new Splash\Tasking\SplashTaskingBundle(), // ... ); }

Create Your First Job

Background jobs must extend Splash\Tasking\Model\AbstractJob.

use Splash\Tasking\Model\AbstractJob; class MyJob extends AbstractJob { /** @return bool */ public function execute() : bool { // Execute your background operations // ... return true; } }

Job Token may be defined multiple way:

use Splash\Tasking\Model\AbstractJob; class MyJob extends AbstractJob { /** You can set it directly by overriding this constant */ protected $token = ""; /**  * Or by writing an array of parameters to setToken()  * @param array $parameters   * @return self  */ public function setup(array $parameters): self { //====================================================================// // Setup Job Token $this->setToken($parameters); return $this; } }

Available Job Types

There are few predefined abstract job types, for different kinds of tasks:

  • Splash\Tasking\Model\AbstractJob: a single simple task, executed once by job class.
  • Splash\Tasking\Model\AbstractServiceJob: execute a Symfony service action with given parameters
  • Splash\Tasking\Model\AbstractStaticJob: a simple task, executed & repeated every XX minutes.
  • Splash\Tasking\Model\AbstractBatch: step-by-step, execute multiple tasks inside a single job.

Symfony Commands

The bundle comes with management commands to pilot workers from command line.

tasking:check Tasking Service : Check Supervisor Process is Running on Current Machines tasking:start Tasking Service : Start All Supervisors & Workers Process on All Machines tasking:status Tasking Service : Check Status of Tasking Services tasking:stop Tasking Service : Stop All Supervisors & Workers Process on All Machines tasking:supervisor Run a Supervisor Worker Process tasking:worker Run a Tasking Worker Process 

Note: Tasking processes & supervisor are activated & checked each time a new task is added to queue

Configuration reference

Bundle configuration are stored under splash_tasking:

splash_tasking: entity_manager: default // Name of Doctrine Entity Manager to use for Tasks & Token Storage environement: prod // Symfony Environnement to use for workers refresh_delay: 3 // Delay for workers status refresh watchdog_delay: 30 // Watchdog delay for tasks execution multiserver: false // Enable multiserver mode multiserver_path: '' // Url for remote servers checks  server: force_crontab: false // Use crontab to ensure supervisor is running (Useless if you uses 3+ workers) php_version: php // Bash comamnd for php supervisor: max_age: 3600 // Time to live of supervisor process, if reached, process will die refresh_delay: 500 // Delay between two worker refresh  max_workers: 3 // Number of worker to use max_memory: 100 // Max. Memory, if reached, process will die workers: max_tasks: 100 // Max. number of jobs to execute, if reached, process will die max_age: 120 // Time to live of a worker process, if reached, process will die max_memory: 200 // Max. Memory, if reached, process will die tasks: max_age: 180 // Time to live of a finished task in database try_count: 5 // Number of failed attemps for a task try_delay: 120 // Delay before retry of a failed task static: // Key => Class values for Static Jobs myStaticJob: AppBundle\Jobs\MyStaticJob 

Docker Dev Environnement

A Docker Compose file is available to run a development server. You can start it typing the following at the command prompt:

docker-compose up -d

Testing & Code Quality

This bundle uses Phpunit for functional testing.

docker-compose exec app php vendor/bin/phpunit 

This bundle uses Grumphp for all code quality checks (PHPMD, PhpCsFixer, PhpStan, and more...).

docker-compose exec app php vendor/bin/grumphp run 

License

This package is available under the MIT license.

统计信息

  • 总下载量: 4.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固