flowpack/task
Composer 安装命令:
composer require flowpack/task
包简介
A Task scheduler for Neos Flow
README 文档
README
This package provides a simple to use task scheduler for Neos Flow. Tasks are configured via settings, recurring tasks can be configured using cron syntax. Detailed options configure the first and last executions as well as options for the class handling the task.
Scheduling and running tasks are decoupled: The Scheduler schedules tasks whcih the are executed by the TaskRunner. This architecture allows receiving and displaying metrics of already executed tasks.
Most of the architectural ideas behind the package are taken from php-task, and reimplemented for Neos Flow.
Installation
composer require 'flowpack/task'
Configuration
Defining A Task
Flowpack: Task: tasks: 'a-unique-identifier': label: The label of this task description: Some detailed description of this task # A class, implementing the TaskHandlerInterface handlerClass: 'Vendor\Package\TaskHandler\TaskHandlerClass' cronExpression: '*/5 * * * *' # A workload, eg. some configuration, given to the taskHandler workload: interval: PT5M
General Options
-
lockStorage: Configuration string for the lock storage used for taskHandler implementingLockingTaskHandlerInterface. See https://symfony.com/doc/current/components/lock.html#available-stores for more options -
keepTaskExecutionHistory: Number of task executions to keep in the database. (default: 3)
Implementing A Task Handler
A task handler contains the code executed for a specific task. Your command handler has to implement one of the following interfaces:
Flowpack\Task\TaskHandler\TaskHandlerInterface
A basic task. The interface requires the method handle(WorkloadInterface $workload): string to be implemented. The return value serves as information for successfully executed tasks.
Flowpack\Task\TaskHandler\RetryTaskHandlerInterface
Also requires getMaximumAttempts(): int to be implemented. Allowing the tasks to be retried on failure.
Flowpack\Task\TaskHandler\LockingTaskHandlerInterface
Also requires getLockIdentifier(WorkloadInterface $workload): string to be implemented. The return value specifies a lock to be acquired. When such a task is running, other tasks requiring the same lock will be skipped.
Available Commands
Schedule and run due tasks
./flow task:run
Schedule and run a single task
./flow task:runSingle <taskIdentifier>
Show a list of all defined and scheduled tasks:
./flow task:list
Show details about a specific task:
./flow task:show <taskIdentifier>
flowpack/task 适用场景与选型建议
flowpack/task 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38.68k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2021 年 07 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 flowpack/task 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 flowpack/task 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 38.68k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-29