flowpack/jobqueue-doctrine 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

flowpack/jobqueue-doctrine

Composer 安装命令:

composer require flowpack/jobqueue-doctrine

包简介

Implements concrete Queue for the doctrine work queue. Requires the packages flowpack/jobqueue-common to be installed.

README 文档

README

A job queue backend for the Flowpack.JobQueue.Common package based on Doctrine.

Usage

Install the package using Composer:

composer require flowpack/jobqueue-doctrine

If not already installed, that will fetch its requirements, namely the jobqueue-common package.

Now the queue can be configured like this:

Flowpack:
  JobQueue:
    Common:
      queues:
        'some-queue':
          className: 'Flowpack\JobQueue\Doctrine\Queue\DoctrineQueue'
          executeIsolated: true
          options:
            defaultTimeout: 50
          releaseOptions:
            priority: 512
            delay: 120

The required tables can be created executing:

./flow queue:setup some-queue

Boost Mode

The poll interval should be short enough to process messages in time, and long enough to minimize resource consumption for the database. Boost mode is a solution which automatically handles spikes by processing messages in quick succession. When no new messages appear for a specified time, boost mode is disabled again.

The frequency by which the queue loop will look for new messages is the configured pollInterval. In boost mode, the option boostPollInterval is used instead. boostTime defines the time since the last processed message after which boost mode is deactivated again.

Specific options

The DoctrineQueue supports following options:

Option Type Default Description
defaultTimeout integer 60 Number of seconds new messages are waited for before a timeout occurs, this is overridden by a "timeout" argument in the waitAndTake() and waitAndReserve() methods
pollInterval float 1 Number of seconds between SQL lookups for new messages
boostPollInterval float 0.5 Number of seconds between SQL lookups for new messages when in "boost mode"
boostTime float 10 Maximum number of seconds since last processed message to activate "boost mode"
tableName string flowpack_jobqueue_messages_ Name of the database table for this queue. By default this is the queue name prefixed with "flowpack_jobqueue_messages_"
backendOptions array - Doctrine-specific connection params (see Doctrine reference)

NOTE: The DoctrineQueue should work with any database supported by Doctrine DBAL. It has been tested on MySQL, PostgreSQL, SQL Server and SQLite. You can specify the backend via the backendOptions. If you omit this setting, the current connection will be re-used (i.e. the currently active Flow database).

Submit options

Additional options supported by JobManager::queue(), DoctrineQueue::submit() and the Job\Defer annotation:

Option Type Default Description
delay integer 0 Number of seconds before a message is marked "ready" after submission. This can be useful to prevent premature execution of jobs (i.e. before entities are persisted)

Release options

Additional options to be specified via releaseOptions for the queue:

Option Type Default Description
delay integer 0 Number of seconds before a message is marked "ready" after it has been released.

License

This package is licensed under the MIT license

Contributions

Pull-Requests are more than welcome. Make sure to read the Code Of Conduct.

flowpack/jobqueue-doctrine 适用场景与选型建议

flowpack/jobqueue-doctrine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 240.93k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2016 年 07 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 flowpack/jobqueue-doctrine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 flowpack/jobqueue-doctrine 我们能提供哪些服务?
定制开发 / 二次开发

基于 flowpack/jobqueue-doctrine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-20